Grid Checkbox Select all (How to)

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
bluebird
Posts: 130
Joined: Wed Sep 28, 2016 3:55 am
Has thanked: 33 times
Been thanked: 5 times

Grid Checkbox Select all (How to)

Post by bluebird » Thu Feb 08, 2018 5:46 am

When selecting from a grid list with checkboxes

I would like to know of a way to select ALL checkboxes, perhaps with an ALT+Key
or something. if its possible it would be convenient to only deselect a minority of
items rather than selecting the majority one by one.

Thanks all.

edk
Posts: 231
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Has thanked: 67 times
Been thanked: 167 times

Post by edk » Thu Feb 08, 2018 8:27 am

try:

Code: Select all

ON KEY ALT+ADD ACTION Form_1.Grid_1.CheckBoxAllItems := .T.		//ALT with Num+ :=> Check All
ON KEY ALT+SUBTRACT ACTION Form_1.Grid_1.CheckBoxAllItems := .F.	//ALT with Num- :=> UnCheck All
ON KEY ALT+MULTIPLY ACTION ReverseCheck()				//ALT with Num* :=> Reverse Check/UnCheck All

@ 450, 155 BUTTON Button_1 CAPTION "Check All" ACTION Form_1.Grid_1.CheckBoxAllItems := .T.
@ 450, 355 BUTTON Button_2 CAPTION "UnCheck All" ACTION Form_1.Grid_1.CheckBoxAllItems := .F.
@ 450, 555 BUTTON Button_3 CAPTION "Reverse Check" ACTION ReverseCheck()

****************************
FUNCTION ReverseCheck()
Local i
FOR i = 1 TO Form_1.Grid_1.ItemCount
	Form_1.Grid_1.CheckBoxItem ( i ) := ! Form_1.Grid_1.CheckBoxItem ( i )
NEXT i
RETURN

Post Reply