Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox in a listbox object
Message
 
 
To
30/12/2000 13:41:07
Christian Cote
Les Logiciels Onoma Inc.
Longueuil, Quebec, Canada
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00458114
Message ID:
00458160
Views:
14
>HI,
>I would like to add a checkbox to a listbox. I have listbox that has a view for rowsource. The view has a logical field (lsubscribed) and I would like to be able to change the value of the field using a checkbox. The listbox is displaying the name of the member and the fact that the member has a valid membership or not.
>
>Thank you very much,
>
>Christian Cote

Hi Christian,

In VFP 6.0 FAQ I found the following:
Question 2-6: How can I add check boxes in my ListBox control?

Answer: A commonly requested enhancement has been to add check box support to the Visual FoxPro native ListBox control. The new version of the Microsoft ActiveX ListView control as well as the Treeview control now support check boxes. These controls ship with Visual FoxPro 6.0 (see Question 2-7).

Question 2-7: My Visual FoxPro 5.0 forms containing certain controls such as ListView or TreeView do not inherit the latest features of these controls (such as check box support). Distributed applications with these forms do not function correctly on end-user machines because of an OLE error with the form.

Answer: In version 6.0, the file containing the following ActiveX controls was renamed from Comctl32.ocx to Mscomctl.ocx:

Microsoft ListView Control
Microsoft TreeView Control
Microsoft ImageList Control
Microsoft ProgressBar Control
Microsoft StatusBar Control
Microsoft Slider Control
Microsoft Tabstrip Control
Microsoft Toolbar Control

Even though Visual FoxPro 6.0 upgrades to the new Mscomctl.ocx file, older version 5.0 forms with these controls will still reference the older file since the ActiveX control is bound by its OleClass property. ActiveX controls from the older Comctl32.ocx file have a version of 1. For example, the OleClass property for a ListView control on a 5.0 form would say:

COMCTL.ListViewCtrl.1

Newer ActiveX controls in the Mscomctl.ocx file have a version 2 (or higher). For example:

COMCTL.TreeViewCtrl.2

Visual FoxPro will not automatically upgrade your control, so it is important to know which version of an ActiveX control a form uses when distributing your applications.


Actually, you may just use a some character (say, V), which would look like check mark. Another simple solution just use +. This is a simple example from one of my application:
********************************************************************
*  Description.......: lstDBC.Click
*  Calling Samples...: 
*  Parameter List....: 
*  Created by........:  
*  Modified by.......: 
********************************************************************
local lnI, llSelect
lnI=this.listindex
llSelect=(thisform.laWgStates[lnI,2]=space(1))
thisform.laWgStates[lnI,2]=iif(llSelect,'+',space(1))
this.selected[lni]=llSelect
this.refresh()
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform