I am trying to implement in a DesktopListbox some events (with MouseMove, MouseDown, MouseUp, etc) to display using the CellTextPaint some images in a cell on each rows.
I try to emulate a button with the hover / pressed event but I am a bit struggling on how should I store the data to know what image to draw.
I tried to store such information on the celltag but I have some issues when the user change window with alt-tab (or cmd-tab) or when the user move the mouse quickly. The issues are that the property that I store in the celltag are not refreshed correctly and the drawing of the correct image is not done with the correct image.
I wanted to know if there is a better way to do that or if just I need to improve my code to make it work correctly using my current approach
My code looks like this
var row as integer = me.getRowCurrentMouseLocation() var column as integer = me.getColumnCurrentMouseLocation() if row > -1 and row <= me.LastRowIndex then if column = me.kOrderColAction then var cellX as integer = me.getCellXByColumnAndX(column,x) var cellY as integer = me.getCellYByRowAndY(row,y) if me.isMouseHoverActionButton(row,column,cellX,cellY) then me.CellTagAt(row,column) = "hover" else me.CellTagAt(row,column) = nil end if else me.CellTagAt(row,me.kOrderColAction) = nil end if end if RaiseEvent mousemoved(x,y)
and in the CellTextPaint Event, I check the celltag and draw the corresponding image. I have the similar code for the MouseDown that set “pressed” in the celltag