Xojo 2019r1.1 Listbox IGNORES click events

Listbox OPEN event

Dim rs  As RecordSet
Dim SQL As String
SQL=_
"SELECT DISTINCT deviceName,device_id,isIphone"+_
"  FROM TEMPLATE.devices " +_
" WHERE device_id<>"+Str(current_DEVICE.ID)+_
" ORDER BY isIphone desc,deviceHeight"
Call DB_PROJECT.DB_Select(SQL,rs)
While Not rs.eof
  Dim dev As String  = rs.field("deviceName").StringValue
  Dim tag As Integer = rs.field("device_id").IntegerValue   
  Me.AddRow(dev)
  Me.RowTag(Me.LastIndex) = tag
  me.ColumnType(0)           = listbox.TypeCheckbox
  rs.MoveNext
Wend
Me.ListIndex=0

Listbox Cell Click Event

If row>lb(index).ListCount Then 
  Return False  //< BREAKPOINT HERE.. NEVER FIRES
End If
If lb(index).CellState(row,column)=checkbox.CheckedStates.Checked Then 
  lb(index).CellState(row,column)=checkbox.CheckedStates.Unchecked
Else
  lb(index).CellState(row,column)=checkbox.CheckedStates.Checked
End If
Return true //< BREAKPOINT HERE.. NEVER FIRES

Cell Background Paint

If row>lb(index).ListCount Then
   Return False  //< BREAKPOINT HERE.. NEVER FIRES
End If
  g.ForeColor=Color.orange
If lb(index).CellState(row,column)=checkbox.CheckedStates.Checked Then 
  g.ForeColor=Color.Yellow
Else
  g.ForeColor=Color.magenta
End If
g.fillrect 0,0,g.Width,g.Height
Return False  //< BREAKPOINT HERE.. NEVER FIRES

I would EXPECT the cell to be ORANGE, YELLOW or MAGENTA… but no, its white… .and since the BP don’t work, I can’t find why

The idea is to have a checkmark, and if the user clicks ANYWHERE in the cell the Checkmark switchs. If the Mark is ON, the cell should be yellow, if it is OFF it should be magenta

Is the listbox subclassed?

nope… just a plain old listbox, with the events from above… nothing move
It is in a Groupbox… but I pulled it out to the main window, and nothing changed

Are you by chance returning True in the MouseDown event? This would prevent CellClick from firing.

there is no mousedown event… the only events are the ones shown above

Break points on return statements have been dodgy for a while and getting worse
There are several bug reports about break points being skipped
Try a plain BREAK statement of put in something like

    if 1 = 2 then // break statement here 
         break
   end if

instead

Don’t checkbox cells fire CellAction?

2 Likes

Tim is right.

Clicking on a checkbox in the cell only changes the checkbox state and fires CellAction.

-Karen

CellClick doesn’t work even if NOT clicking on the Checkbox. nor does it work If I change the cells to “standard” cells

If these are the listbox’ event handlers: Why do you address lb(index) each time instead of me?

Silly idea, but maybe drag a new listbox on to the window and see if the events fire on it. I’ve seen strange things get fixed when instantiating a new one.

that was this mornings plan…

as to lb(index) … I had changed them to me… no change

Ok… here is my test

  1. Dragged a fresh LB to the window (not inside anything else)
  2. populated with a few strings “A”,“B”,“C”
  3. Put “BEEP” in the OPEN EVENT
  4. put “BEEP” in the CellClick Event

Expectation

  1. a single beep when the listbox appeared … THIS WORKED
  2. a single beep every time I clicked on a row. THIS DID NOT WORK. the row was “highlighted” but the event did not fire

EDIT :
I duplicated the above test in a NEW project… single window, single LB… and it all works

WHAT could exist in the much larger project that would stop this?

Discovered the issue.

Listbox did NOT like being in a GROUP BOX on a Sheet Window.
Moved the LB out of the GB… .and it worked just fine.

1 Like

Ug…I hate issues like that.