Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selection box on grid

Status
Not open for further replies.

Jerim65

Technical User
Aug 8, 2010
99
AU
I have a grid based on a table with a 'Selected' logical field. I have inserted a selection box in the field on the grid.

I want a user to be able to click in selection box ( this is Ok and working) but if they change their mind how do I negate their previous selection and just show their latest selection.

I only want the latest selection to show 'ticked'

Thanks Coldan
 
A Listbox is better for a single choice in the first place, but if you do that with a grid, then you need to set .F. all other records.

Interactivechange of the checkbox:
Code:
if this.value
   update (this.parent.parent.recordsource) set selection=.f.
   replace next 1 selection with .t. in (this.parent.parent.recordsource)
endif

Bye, Olaf.
 
An alternate way would be to replace the default Grid Textbox with a Selection Checkbox which would allow the user to Check or UnCheck the individual record. And you could put buttons on the Form to Check All or Clear All.

Good Luck,
JRB-Bldr
 
Coldan,

or show all records (even the unselected ones) but put an index on the cursor so that the selected ones always appear at the top.


nigel
 
Olaf,

Thanks Olaf

Your code is what I had been unable to work out although I knew that was what was necessary.

However

1 I added a line thisform.grid1.refresh to the code to allow me see it working in the debugger.

2 When running in the application each checkbox I clicked stayed selected.

3 Another click removed the tick which is I think the way it operated without your code.

Any thoughts?

Coldan
 
Have you set sparse .F.? If not, only the current row is refreshed.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top