1. Can get mouse procedure and handler to work!!!
- Posted by tmathis May 25, 2010
- 1555 views
This is driving me crazyI am newbie trying to learn by doing. I modified the following code in sample exw demo richedit2.exw demo. The code works (popup activates)with the RightDown mouse action but will not work with the leftdown action. In fact I can't make any of the following respond!
MouseMove:LeftDown: LeftUp: RightUp: LeftDoubleClick*:et cetera.
procedure RE_w32HMouse( integer self, integer event, sequence params )
if params[1] = LeftDown then popup( {Popup1,self}, params[2]-6, params[3]-6 ) elsif params[1] = RightDown then popup( {Popup1,self}, params[2]-6, params[3]-6 )
end if
end procedure
Any help appreciated
Tim
2. Re: Can get mouse procedure and handler to work!!!
- Posted by dcole May 27, 2010
- 1411 views
Hello tmathis,
without warning include win32lib.ew constant w = createEx( Window, "MouseTraps", 0, 100, 100, 400, 300, 0, 0 ) constant s = create(StatusBar, "", w, 0, 0, 0, 0, 0) constant PushButton2 = createEx( PushButton, "PushButton2", w, 72, 124, 88, 28, 0,0 ) constant Group3 = createEx( Group, "Group3", w, 248, 160, 148, 60, 0, 0 ) constant PushButton4 = createEx( PushButton, "PushButton4", Group3, 12, 16, 88, 28,0, 0 ) VOID = createMouseTrap(w,PushButton2) VOID = createMouseTrap(w,PushButton4) procedure MouseTrap(integer self, integer event, sequence params) puts(1,"mouse hit" &"\n") ?params end procedure setHandler(w, w32HMouseTrap, routine_id("MouseTrap")) WinMain(-1, 0)
Don Cole
3. Re: Can get mouse procedure and handler to work!!!
- Posted by DerekParnell (admin) May 27, 2010
- 1336 views
This is driving me crazyI am newbie trying to learn by doing. I modified the following code in sample exw demo richedit2.exw demo. The code works (popup activates)with the RightDown mouse action but will not work with the leftdown action. In fact I can't make any of the following respond!
The 'edit' controls capture the left button event before your app gets to see it. They do this so they can move the cursor to where ever you clicked in the control. It would be a bad idea to break the expected UI behavior by making the left button activate a popup menu. A better way is to use the right button in conjunction with one of the 'control' keys such as 'SHIFT' or 'CTRL'.
Read the docs for the 'attachPopup' routine in the Win32lib for details.
4. Re: Can get mouse procedure and handler to work!!!
- Posted by tmathis May 28, 2010
- 1363 views
Thanks Derek For taking the time to reply to my questions.
That would have taken a long time for me figure out. I guess I would have to had look at the edit support program to figure that outThanks again. Tim
5. Re: Can get mouse procedure and handler to work!!!
- Posted by tmathis May 28, 2010
- 1374 views
Thanks Dcole
I will try out this code tonite.
Tim
6. Re: Can get mouse procedure and handler to work!!!
- Posted by dcole May 28, 2010
- 1285 views
Hello Tim,
I forgot to mention,
params is ( int event, int x, int y, int shift, int wheelmove )
Event is left or right mouse button pushed.
I copied this code from the samples. Ignore the group and other button. I was trying to demonstrate the use of setHandler and Procedure.
There is a file called 'Index.htm' that comes with Euphoria. Find it and put a shortcut on your desktop. You will refer to it often.
Don Cole