But the problem with filters on a table is the scroll bars in the grid don't work correctly, frustrating users. You can sort a grid without requery and an optimized query is pretty fast. Users will get used to it and appreciate the "working" grid.
>Thanks for the response. Judging by your answer, it sounds like unbound checkboxes in a grid tied to a table just don't work, which confirms my own experience trying to get it to work. I was hoping to avoid using a cursor because I have several filter and sort options that allow the user to view only certain records and/or change the order in which they are displayed. As the underlying table grows, which I know it will, the form's refresh will bog down significantly if I have to rebuild the cursor everytime. Views, I think, would present a similar problem. I found a thread this afternoon that has provided the answer (Thread #
1103071 Message #
1103178) using the DynamicCurrentControl property of a grid column. Since I had already added a logical field to my underlying table, I used the column bound to that field for this operation. I created 2 command button classes, one with a check mark image, one without. The CommandUnChecked has the following code in the click() method:
>
>this.parent.parent.aSelected[recno(this.parent.parent.recordsource)] = .t.
>thisform.Refresh()
>
>The CommandChecked has the following code in the click() method:
>
>this.parent.parent.aSelected[recno(this.parent.parent.recordsource)] = .f.
>thisform.Refresh()
>
>I then added the following code to the grid's init method:
>
>this.addproperty("aSelected[1]")
>DIMENSION this.aSelected(reccount(this.recordsource))
>this.aSelected = .f.
>WITH this.columns(1)
> .AddObject('cmdChecked1', 'CommandChecked')
> .AddObject('cmdUnChecked1', 'CommandUnChecked')
> .currentcontrol = 'cmdUnChecked1'
> .cmdUnChecked1.visible = .t.
> .cmdChecked1.visible = .t.
> .sparse = .f.
> .DynamicCurrentControl=;
> [iif(this.aSelected(recno()), "cmdChecked1", "cmdUnChecked1")]
>ENDWITH
>
>When I run the form and click the button, the array gets updated, the visible button gets switched, and the underlying table is unchanged. Now I just need to add code that updates the array when records get added or deleted...Thanks again.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer