In the 4D v11 SQL List Box, Boolean column standard behavior is different from other columns. Because a boolean column can be specified to display a Check Box or Pop-up menu, it responds to the "On Data Change" Form Event and not to the "On Clicked" Form Event. A byproduct of this behavior is that events in Boolean columns do not automatically highlight the row, as do clicks on other columns.
Highlighting rows in a Boolean column upon data change depends on the type of List Box being used. The first example highlights the row in a List Box displaying records. The second is for a List Box displaying arrays.
EXAMPLE 1 - List Box displaying records
From the Property List for the List Box, in the List Box theme, enter a name for the "Highlight Set". For this Tech Tip the highlight set is named "MySet".
From the Property List for the Boolean column, ensure that the "On Data Change" form event is checked in the Events theme. Next, in the Action theme, click the "Edit..." button to open the object method editor.
In the object method, add code similar to the following:
$FormEvt_L:=Form event $Self_P:=Self Case of : ($FormEvt_L=On Data Change ) If ($Self_P->) ADD TO SET([MyTable];"MySet") Else REMOVE FROM SET([MyTable];"MySet") End if End case |
The row will now be highlighted, or not, in response to the data change in the boolean column.
EXAMPLE 2 - List Box displaying arrays
List Boxes that display arrays are associated to a variable defined as type Boolean Array. Rows in this array that are TRUE are highlighted. In this example, the List Box object is named "MyArraysListBox_aB". In its object method, add code similar to the following:
Case of : ($FormEvt_L=On Data Change ) MyArraysListBox_aB{ MyBoolCol_aB } := MyBoolCol_aB{ MyBoolCol_aB } End case |
The row will now be highlighted, or not, in response to the data change in the boolean column.