Discussions related to Visual Prolog
daveplummermd
VIP Member
Posts: 80
Joined: 18 Jul 2006 17:18

"onPushButtonMouseEnter" event not detected

Unread post by daveplummermd »

Guys

I am trying to detect a mouse over a dialog push button.

I use the following:

Code: Select all

predicates     onPushButtonMouseEnter : window::mouseEnterListener. clauses     onPushButtonMouseEnter(_, _, _Flags):-         vpiCommonDialogs::note("entered"),         !.
Should this detect a mouse-over-button and fire the clause?

Thanks in advance

Dave
Dave Plummer
User avatar
Tonton Luc
VIP Member
Posts: 204
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc »

Hi,

Maybe this code can help you :

Code: Select all

clauses     new(Parent) :-         dialog::new(Parent),         generatedInitialize(),         your_dialog_pushButton_ctl:setSubClassHandler(subEH,false) %add this line here         .   predicates     subEH : eHandler. clauses   subEH(Win,e_MouseMove(Pnt,_,_)) = _ :-     setText(toString(Pnt)).
daveplummermd
VIP Member
Posts: 80
Joined: 18 Jul 2006 17:18

Unread post by daveplummermd »

Tonton

Thanks so much.

When code entered exactly as you outlined, the compiler complains that the return value for the eventhandler "subEH" is not fully bound.

Code: Select all

clauses     new(Parent) :-         dialog::new(Parent),         generatedInitialize(),         pushButton_ctl:setSubClassHandler(subEH,false) .     predicates     subEH : eHandler. clauses   subEH(Win,e_MouseMove(Pnt,_,_))=_:-     setText(toString(Pnt)).
The clause subEH must return a bound value of the type gui_native::lResult Can you advise?

Thanks in advance.

Dave
Dave Plummer
User avatar
Tonton Luc
VIP Member
Posts: 204
Joined: 16 Oct 2001 23:01

Unread post by Tonton Luc »

Hi Dave,

Try this :

Code: Select all

clauses   subEH(Win,e_MouseMove(Pnt,_,_))=0:-     setText(toString(Pnt)).
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

The the size of domains lParam, wParam and lResult is 32bit on win32 and 64bit on x64. Therefore it is not as simple as it used to be.

The gui_api class contains a number of constants:

Code: Select all

constants     wNull : wParam = uncheckedConvert(wParam, nullHandle).     wFalse : wParam = wNull.     wTrue : wParam = uncheckedConvert(wParam, uncheckedConvert(handle, 1)).     wMinusOne : wParam = uncheckedConvert(wParam, uncheckedConvert(handle, -1)).     lNull : lParam = uncheckedConvert(lParam, nullHandle).     lFalse : lParam = lNull.     lTrue : lParam = uncheckedConvert(lParam, wTrue).     lMinusOne : lParam = uncheckedConvert(lParam, uncheckedConvert(handle, -1)).     rNull : lResult = uncheckedConvert(lResult, nullHandle).     rFalse : lResult = rNull.     rTrue : lResult = uncheckedConvert(lResult, wTrue).     rMinusOne : lResult = uncheckedConvert(lResult, uncheckedConvert(handle, -1)).     % @short Constant of type wParam/lParam/lResult.     % @end
Injection functions:

Code: Select all

predicates     mkW : (integer Integer) -> wParam WParam.     mkW : (unsigned Unsigned) -> wParam WParam.     mkL : (integer Integer) -> lParam LParam.     mkL : (unsigned Unsigned) -> lParam LParam.     mkR : (integer Unsigned) -> lResult LResult.     mkR : (unsigned Unsigned) -> lResult LResult.     % @short Make an wParam/lParam/lResult from an integer/unsigned.     % @end
And projection functions:

Code: Select all

predicates     getUnsigned : (unsignedNative WParam) -> unsigned Integer language prolog as "gui_api_getParam".     getUnsigned : (integerNative WParam) -> unsigned Integer language prolog as "gui_api_getParam".     getUnsigned : (wParam WParam) -> unsigned Unsigned language prolog as "gui_api_getParam".     getUnsigned : (lParam LParam) -> unsigned Unsigned language prolog as "gui_api_getParam".     getUnsigned : (lResult LResult) -> unsigned Unsigned language prolog as "gui_api_getParam".     getInteger : (unsignedNative WParam) -> integer Integer language prolog as "gui_api_getParam".     getInteger : (integerNative WParam) -> integer Integer language prolog as "gui_api_getParam".     getInteger : (wParam WParam) -> integer Integer language prolog as "gui_api_getParam".     getInteger : (lParam LParam) -> integer Integer language prolog as "gui_api_getParam".     getInteger : (lResult LResult) -> integer Integer language prolog as "gui_api_getParam".     % @short Convert a wParam/lParam/lResult to an unsigned/integer.     % @end
To assist with these domains. Pointers and pointer-represented values should simply be uncehckedConverted to/from the corresponding domain.

If you want to return 0 you can use gui_api::rNull.
Regards Thomas Linder Puls
PDC
daveplummermd
VIP Member
Posts: 80
Joined: 18 Jul 2006 17:18

Unread post by daveplummermd »

Guys

Thanks for these very helpful replies. I always learn stuff beyond the scope of the initial question.

BTW...what is with all the "term paper" crap on the board.....can this be removed or otherwise cleaned up?

Thanks again

Dave P
Dave Plummer
Post Reply