Catch MOUSEEVENT on ListView?

BlitzMax Forums/BlitzMax Programming/Catch MOUSEEVENT on ListView?

hi,

can someone help me? How can i get a event, when i hit mousebutton in a ListView-Item. i need something to get TRUE, when i hit RIGHT mousebutton...

*push*

Hm, i didn't got it with events. I used a canvas
under the listboxitem. It's a very
baaaad codestil. I tested it under Win, it works!
Don't know whether that is platformindependent.

Look at this code german fellow. ;)

window=CreateWindow("asd",10,10,400,400)

canvas=CreateCanvas(0,0,400,300,window)
listbox=CreateListBox(0,0,400,300,window)
AddGadgetItem listbox,"asd"
AddGadgetItem listbox,"asd2"
AddGadgetItem listbox,"asd3"

'HideGadget canvas
'ActivateGadget canvas

While WaitEvent()
Select EventID()
Case EVENT_WINDOWCLOSE
End

Case EVENT_MOUSEDOWN
Select EventData()
Case 1
SelectGadgetItem listbox,Rand(0,2)
'RedrawGadget listbox
'RedrawGadget canvas
'Notify("MT2")
End Select

End Select

Wend


IMurDOOM

hm... :-/

ok i check this also with panels later - panels are more resources-friendly

hmmm it tested it... panel work at the same way... but

panel or canvas eat all events - i can't select a list gadget with mouse... that is bad... what i need is only a mousebutton-event on treelist

:-/

If you want to catch the MouseEvents on a tree or listview here is a small workaround for Win32(BTW: This should be in Max for every Gadget)

First you have to find the "win32listbox.cpp" in "mod\brl.mod\win32maxgui.mod\win32gui" and open it.

The First Function in this code related to the listbox is

Win32ListBox::Win32ListBox( BBGroup *group,int style ):BBListBox(group,style){
... a few things
...
_gadget.setWndProc(this);
}


Now to add the MouseEvents to the Listbox you simply have to
add one line, so it looks as follows:

Win32ListBox::Win32ListBox( BBGroup *group,int style ):BBListBox(group,style){
... a few things
...
_gadget.setWndProc(this);
_gadget.setEventMask( BBEVENT_MOUSEMASK,this );
}


And now you also catch the MouseEvents in a ListBox (completely with the x and y coordinates)

Only tested with listboxes, but should work also with every other Gadget.

BTW:
By changing :
setEventMask( BBEVENT_MOUSEMASK,this );
to
setEventMask( BBEVENT_MOUSEMASK|BBEVENT_KEYMASK,this );
You can also catch the keys pressed in the listbox

I hope this solves your problems

oh hell...

i think, mark should add this to all gadgets... i don't like to modify cpp code at each update...