Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multi Select Grid Class
Message
 
To
14/10/1997 15:03:38
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00054508
Message ID:
00054643
Views:
34
>VFP5.0a
>I am trying to create a multi select grid class. In the class I maintain an array that has one element for every record in the grid table. I am using the following dynamicbackcolor property to display selected rows. The array elements are currently set with a keypress method called in the controls keypress event. Right now I am only using the up & down arrows in conjunction with the shift key until I get some of the bugs worked out. My problem occurs when keys are pressed very quickly or held down. The record pointer ends up ahead of the selected rows or the first column will be incorrectly selected and all of the other columns will be ok.
>
>this.SetAll("DynamicBackColor","IIF(iif(reccount(this.SelectedAlias)<=alen(this.SelectedArray),this.SelectedArray(recno(this.SelectedAlias)),.f.),GetSysColor(10),RGB(255,255,255))", "Column")
>
>My first question is can anyone make a suggestion here?
>
>My second question is am I reinventing the wheel? Are there controls available that do this allready? I would need source code.

Hi Dan,

I've created a multi-select grid and I haven't heard of another so I don't think that you are recreating the wheel here. Instead of an array I create a cursor that holds the record numbers of the items selected by a user.

CREATE CURSOR USERPICK (RecNum N(10))
INDEX ON RecNum TAG RECNUM ADDITIVE

Then for the column color change I do both fore and back colors;

Grid.SetAll("DynamicBackColor", 'IIF(SEEK(RECNO(THIS.RecordSource), ;
"USERPICK"), RGB(0, 0, 128), RGB(255, 255, 255)', "Column")

Grid.SetAll("DynamicForeColor", 'IIF(SEEK(RECNO(THIS.RecordSource), ;
"USERPICK"), RGB(255, 255, 255), RGB(0, 0, 0)', "Column")

The above gives a typical blue background white foreground for selected items.
The grid itself has a method called .UserPick() which does the INSERTing or
DELETing from the USERPICK cursor. The .UserPick() method is called from the textbox control in the .MouseDown() event.

Steve Despres
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform