Listbox selected problem

Hello,
i want to fire up the “change” event when a celltag is “active” but the app crashes

the cell background event:

Dim i as integer
g.ForeColor = app.dunkelblau
g.FillRect(0, 0, g.Width, g.Height)

g.ForeColor=app.hellblau
g.DrawLine(0, me.RowHeight-1, me.width, me.RowHeight-1)

dim s as Integer

if  me.listcount>0 then 
  if Me.CellTag(row, 0)="active" then 
    g.ForeColor = app.gruen
    g.FillRect(0, 0, g.Width, g.Height)
    dim p as new Picture(45,30)
    p.Graphics.DrawPicture(playSymbol,15,-2)
    me.RowPicture(row) =p
    me.Selected(row)=true                                 
   return true
  else
    dim p as new Picture(45,30)
    p.Graphics.DrawPicture(playsymbol_inactive,15,-2)
    me.RowPicture(row) =p
  End If
  
end if

in the change event

if me.ListIndex<>-1 then                ////app crashes/hangs with this code in "change event" .... why?
  MsgBox str(me.listindex)
end if 

anybody can help me with that?

Thanks Marco

maybe the select = true cause / call the cell draw event again and again in endless loop.
try using system.debuglog instead of a msgbox and print a timestamp with the debug output.

You’re effectively calling msgbox from inside of cellbackgroundpaint.

If you set a breakpoint on the line if me.ListIndex<>-1 then you’ll see the change method is being called from the line me.Selected(0)=true

Calling msgBox from a paint event will crash on Mac. It’s not a bug, it’s a feature :wink:

Try using system.debuglog for this sort of thing.