Re: Control under the Mouse
Posted: Sat Jan 25, 2014 12:04 am
Eres un mago 
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://mail.hmgforum.com/
Code: Select all
#define WM_SETCURSOR 32
#define WM_PARENTNOTIFY 528
No se como utilizar sus "Dos centavos", alguna idea?, Como se manejan o ...srvet_claudio wrote:Re: Control under the Mouse
My two cents:
Code:
#define WM_SETCURSOR 32
#define WM_PARENTNOTIFY 528
Code: Select all
#define WM_SETCURSOR 32
#define WM_PARENTNOTIFY 528
Function TestMove()
Local hWnd := EventHWND()
Local nMsg:= EventMsg()
Local wParam:= EventWPARAM ()
Local cNom, cForm
if nMsg == WM_SETCURSOR .and. wParam <> w_test.HANDLE
GetControlNameByHandle(wParam,@cNom, @cForm)
msgbox("Event " + str( nMsg,3,0) + " / " + str(wParam,8,0) + " / " + cNom + " / " + cForm )
endif
Return Nil
Function SelectCtrl()
Local hWnd := EventHWND()
Local nMsg:= EventMsg()
Local wParam:= EventWPARAM ()
Local cNom,cForm
Static ctrlselect:= ""
if wParam <> w_test.HANDLE
if nMsg == WM_PARENTNOTIFY .and. !empty(ctrlselect)
msgbox("ctrl selected " + ctrlselect )
else
if nMsg == WM_SETCURSOR
GetControlNameByHandle(wParam,@cNom, @cForm)
ctrlselect:= HMG_UPPER (cNom)
else
ctrlselect:= ""
endif
endif
endif
Return Nil
Wow very nice!!!jpp wrote:hi,
first thanks for ure answers.
A the begining my purpose was to write an ide to save time for designing forms.
( thats why i wanted to know the control's name under the mouse ).
After a cup of day, i realised that foxpro had a good ide ...
As all the form and it's controls are stored into an scx/sct file ( a simple dbf/ftp file ) which is very simple to read with dbu ( rdd dbf/cdx ).
now, it's very simple to convert ur's prg form design to foxpro properties ( as they are quite similar ) and after the foxpro designer, back to hmg prg !
For the moment i've written the first stage ( hmg->foxpro ) and it's very successfull !!!
I will post something when i'll finish the next stage ...
Jpp
Code: Select all
#include <hmg.ch>
#define BLUE1 { 218,229,243 }
#define BLUE2 { 000,120,187 }
STATIC cCtrlAnt:="", lProp:=.F.
Function Main
DEFINE WINDOW w_test AT 000 , 000 WIDTH 230 HEIGHT 380 BACKCOLOR BLUE1 TITLE "SIMULATE A MOUSE OVER --- BY AGL" MAIN
ON KEY ESCAPE ACTION Thiswindow.Release()
@ 030,010 LABEL LB_1 VALUE "Opcion 1" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 1" )
@ 055,010 LABEL LB_2 VALUE "Opcion 2" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 2" )
@ 080,010 LABEL LB_3 VALUE "Opcion 3" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 3" )
@ 105,010 LABEL LB_4 VALUE "Opcion 4" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 4" )
@ 130,010 LABEL LB_5 VALUE "Opcion 5" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 5" )
@ 155,010 LABEL LB_6 VALUE "Opcion 6" OF w_test WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR WHITE BACKCOLOR BLUE2 CENTERALIGN ACTION MsgInfo( "Opcion 6" )
@ 250,000 LABEL LB_7 VALUE "" WIDTH 200 HEIGHT 20 FONT 'Verdana' SIZE 9 FONTCOLOR BLACK CENTERALIGN TRANSPARENT
END WINDOW
CREATE EVENT PROCNAME SELECTCTRL( EventWPARAM() ) // HWND W_test.HANDLE
CENTER WINDOW w_test
ACTIVATE WINDOW w_test
RETURN Nil
FUNCTION SelectCtrl( wParam )
LOCAL cCtrl, cForm, cTemp
GetControlNameByHandle( wParam, @cCtrl, @cForm )
cTemp:=ALLTRIM( cForm )+ALLTRIM( cCtrl )
w_test.LB_7.VALUE := cTemp // **** Display cForn, cCtrl
IF cTemp==cForm
IF lProp
// La intencion es hacer que la Funcion acepte cualquier nombre de Ventana, pero de esta forma no se ejecuta el ACTION del LABEL !
// The intention is to make the function accepts any window name, but this way the ACTION of LABEL is not running!
*SETPROPERTY( cForm, cCtrlAnt, "FONTBOLD" , .F. )
*SETPROPERTY( cForm, cCtrlAnt, "FONTSIZE" , 9 )
*SETPROPERTY( cForm, cCtrlAnt, "BACKCOLOR", BLUE2 )
w_test.&cCtrlAnt..FONTBOLD := .F.
w_test.&cCtrlAnt..FONTSIZE := 9
w_test.&cCtrlAnt..BACKCOLOR := BLUE2
lProp:=.F.
ENDIF
ELSE
IF ! empty(cCtrl)
IF ! lProp
w_test.&cCtrl..FONTBOLD := .T.
w_test.&cCtrl..FONTSIZE := 12
w_test.&cCtrl..BACKCOLOR := BLUE
cCtrlAnt:=cCtrl
lProp:=.T.
ENDIF
ENDIF
ENDIF
RETURN Nil