Page 1 of 1

Event decoding

Posted: Sat Apr 07, 2012 4:56 am
by Tenaja
How do you decode an event? I have this in my

Code: Select all

 Case #PB_Event_Gadget
		Select EventGadget()
			Default
				Debug "Default Event " + Str(EventType())
The code I am getting is 512. How do I figure out what it is?

I am getting the code when I right-click on a Scintilla gadget that does not have the focus, but this test does not show a 512:

Code: Select all

Debug  #PB_EventType_LeftClick       ; Left mouse button click
Debug  #PB_EventType_RightClick      ; right mouse button click
Debug  #PB_EventType_LeftDoubleClick ; Left mouse button double click
Debug  #PB_EventType_RightDoubleClick; Right mouse button double click
Debug  #PB_EventType_Focus           ; Get the focus.
Debug  #PB_EventType_LostFocus       ; Lose the focus.
Debug  #PB_EventType_Change          ; Content change.
Debug  #PB_EventType_DragStart       ; The user tries To start a Drag & Drop operation.
So, while I DO want to know what event 512 is, even more, I want to know how to reverse-lookup an event number. Clearly, I can just put a DisplayPopupMenu() in that default case, but without knowing for certain what a 512 is, I don't know what unexpected behavior may result.

Thanks!

Edit: It must have to do with focus, because it occurs with left or right clicks.

Re: Event decoding

Posted: Sat Apr 07, 2012 8:58 am
by Danilo
Don't know about decoding, i would just check the windows headers if search engines
don't give a good result.
Searching google for "windows message 512" gives List Of Windows Messages - The Official Wine Wiki
as the first result, and according to the list it is:

Code: Select all

HEX     Decimal   Symbolic
0200    512       WM_MOUSEMOVE

Re: Event decoding

Posted: Sat Apr 07, 2012 11:29 am
by TI-994A
Great resource. Thanks for sharing that, Danilo.

Re: Event decoding

Posted: Sat Apr 07, 2012 5:10 pm
by luis
EDIT: original post removed, I've updated it but the new version is too big too fit in a single post.

Anyways you can get a similar code from netmaestro here: http://www.purebasic.fr/english/viewtop ... 12&t=52180

Re: Event decoding

Posted: Sun Apr 08, 2012 4:59 am
by Tenaja
That list of WM's is great, but it is the PB gadget events that mostly interest me. It turns out the 512 is a SCI message #SCEN_SETFOCUS.

Now that I have that figured out, I'm wondering if anybody knows how to get a right-click popup on the same click that sets the focus? It seems that the event handlers only get the one event, but if you have focus on another place in the program, then right-click on the SCI window hoping to bring up a popup, you don't get it. Does it require use of the gaming mouse commands?

Re: Event decoding

Posted: Sun Apr 08, 2012 10:22 am
by dobro

Re: Event decoding

Posted: Sun Apr 08, 2012 10:43 am
by TI-994A
Hi luis! Thanks for the PBI; even better.
À votre bon cœur, dobro.