Many thanks, Mark. This would do fine - but having run the program, it
occured to me that I'd also need an event when the mouse leaves my dialog.
So I looked up MSDN and tried adding the following to appropriate places in
your program:
::constant WM_MOUSELEAVE 0x02A3 -- from MSDN
...
self~addUserMsg(onLeave, self~WM_MOUSELEAVE, 0xffffffff, 0, 0, 0, 0)
...
::method onLeave unguarded
say "Mouse Left!"
No error, but the method onLeave was never invoked, no matter how often I
had the mouse pointer leave the dialog. Btw I also tried it with addUserMsg
statement of:
self~addUserMsg(onLeave, self~WM_MOUSELEAVE, 0x00000000, 0, 0, 0, 0)
based on something I read in MSDN about values of wParam and LParam.
Any thoughts?
Thx,
Oliver
_____
From: Mark Miesfeld [mailto:[email protected]]
Sent: 12 December 2011 15:06
To: Open Object Rexx Users
Subject: Re: [Oorexx-users] ooDialog - Detect mouse moving over a dialog?
On Mon, Dec 12, 2011 at 5:00 AM, Oliver Sims
<[email protected]> wrote:
I've looked through build 7382 of ooDialog Reference, and have found the
change cursor shape methods.
What I hoped to find was a way to change the mouse pointer to an image of my
own, but it seems that is not possible (??).
This could be possible, but ooDialog currently doesn't have anything that
would support it. So, practically speaking it is not possible at this point
in time.
So next question: can I detect when the mouse moves over my dialog? I've
looked at all the standard event-handling methods, but cannot find one that
tells me when the mouse "enters" or "leaves" my dialog as the user drags the
mouse over it. Does such a thing exist?
The current mouse support in ooDialog was poorly thought out, in my opinion.
But mouse support is not something that lends itself easily to ooDialog.
What is there, is tied to the dialog object. It would be better to have a
mouse class and add features to that class.
Be sure to look at captureMouse(), getMouseCapture(), and
releaseMouseCapture(). Although I haven't ever tried them and my gut
feeling is that they won't give you much.
That said, here is a sample program that shows how to connect the mouse move
event. Problems are going to be: you won't get the notification if the
mouse is over any dialog control in the dialog, there is no way to tell when
the mouse leaves the dialog, and probably other problems. <grin>
This is probably the best you can do at this point:
/* Simple User Dialog template */
dlg = .SimpleDialog~new( , "simple.h")
dlg~execute("SHOWTOP", IDI_DLG_OOREXX)
::requires "ooDialog.cls"
::class 'SimpleDialog' subclass UserDialog
::constant WM_MOUSEMOVE 0x0200
::constant MK_LBUTTON 0x0001
::constant MK_RBUTTON 0x0002
::constant MK_SHIFT 0x0004
::constant MK_CONTROL 0x0008
::constant MK_MBUTTON 0x0010
::constant MK_XBUTTON1 0x0020
::constant MK_XBUTTON2 0x0040
::method init
forward class (super) continue
self~create(30, 30, 257, 123, "Simple Dialog", "CENTER")
self~addUserMsg(onMove, self~WM_MOUSEMOVE, 0xffffffff, 0, 0, 0, 0)
::method defineDialog
self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok")
self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel")
::method onMove unguarded
use arg wParam, lParam
pos = .Point~new(.DlgUtil~sLoWord(lParam), .DlgUtil~sHiWord(lParam))
keys = ''
if .DlgUtil~and(wParam, self~Mk_CONTROL) <> 0 then keys ||= 'Ctrl'
if .DlgUtil~and(wParam, self~Mk_SHIFT) <> 0 then keys ||= ' Shift'
if .DlgUtil~and(wParam, self~Mk_LBUTTON) <> 0 then keys ||= ' LButton'
if .DlgUtil~and(wParam, self~Mk_RBUTTON) <> 0 then keys ||= ' RButton'
if .DlgUtil~and(wParam, self~Mk_MBUTTON) <> 0 then keys ||= ' MButton'
if .DlgUtil~and(wParam, self~Mk_XBUTTON1) <> 0 then keys ||= ' XButton1'
if .DlgUtil~and(wParam, self~Mk_XBUTTON2) <> 0 then keys ||= ' XButton2'
say 'The mouse is at ('pos~x',' pos~y') with these qualifiers:' keys
return 0
You will get output like this:
The mouse is at (95, 78) with these qualifiers:
The mouse is at (93, 76) with these qualifiers:
The mouse is at (87, 72) with these qualifiers:
The mouse is at (47, 119) with these qualifiers: LButton
The mouse is at (72, 79) with these qualifiers:
The mouse is at (45, 148) with these qualifiers: LButton
The mouse is at (57, 164) with these qualifiers: LButton
--
Mark Miesfeld
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Oorexx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-users