mouseover label
Moderator: Rathinagiri
mouseover label
Buenos días.
¿Alguien a implementado el efecto mouseover para un label?
Vi un post donde se discutió en el 2009
http://hmgforum.com/viewtopic.php?f=5&t ... over#p7043
Pero no funciona bien en 3.4.3 y no pude encontrar ningún otro ejemplo.
Saludos.
traducido por google
Good Morning.
Has anyone implemented the mouseover effect for a label?
I saw a post where it was discussed in 2009
[url] http://hmgforum.com/viewtopic.php?f=5&t ... over#p7043 [/ url]
But it doesn´t work well on 3.4.3 and I could not find any other example.
Greetings.
¿Alguien a implementado el efecto mouseover para un label?
Vi un post donde se discutió en el 2009
http://hmgforum.com/viewtopic.php?f=5&t ... over#p7043
Pero no funciona bien en 3.4.3 y no pude encontrar ningún otro ejemplo.
Saludos.
traducido por google
Good Morning.
Has anyone implemented the mouseover effect for a label?
I saw a post where it was discussed in 2009
[url] http://hmgforum.com/viewtopic.php?f=5&t ... over#p7043 [/ url]
But it doesn´t work well on 3.4.3 and I could not find any other example.
Greetings.
,___,
[O.o]
/)__)
-”–”-
KoKe
[O.o]
/)__)
-”–”-
KoKe
Re: mouseover label
Fee years ago I've posted sample with mouseover effect.
Re: mouseover label
Maybe this...
viewtopic.php?f=6&t=4468&p=42565&hilit=vertical#p42565
viewtopic.php?f=9&t=4806&hilit=mouse+andyglez
viewtopic.php?f=6&t=4468&p=42565&hilit=vertical#p42565
viewtopic.php?f=9&t=4806&hilit=mouse+andyglez
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: mouseover label
Can somebody know why WM_MOUSELEAVE message is not generated for LABEL and another controls?
Example of code:
Example of code:
Code: Select all
#include "hmg.ch"
MEMVAR _HMG_SYSDATA
FUNCTION Main()
DEFINE WINDOW MainForm;
WIDTH 300;
HEIGHT 200;
MAIN
DEFINE LABEL Label1
ROW 10
COL 10
WIDTH 140
HEIGHT 45
VALUE "This is LABEL"
ALIGNMENT Center
END LABEL
DEFINE BUTTON CloseButton
ROW 70
COL 10
WIDTH 80
HEIGHT 23
CAPTION "Close"
ACTION MainForm.RELEASE
END BUTTON
END WINDOW
HMG_ChangeWindowStyle(MainForm.Label1.HANDLE, 0x00800200 /*WS_BORDER|SS_CENTERIMAGE*/, NIL, .F., .T.)
EventCreate("LabelEventHandler", MainForm.Label1.HANDLE)
MainForm.CENTER
MainForm.ACTIVATE
RETURN NIL
FUNCTION LabelEventHandler()
STATIC lTracking := .F.
LOCAL nHWnd := EventHWND()
LOCAL nMsg := EventMSG()
SWITCH nMsg
CASE WM_MOUSEMOVE
IF ! lTracking
MainForm.Label1.FONTCOLOR := {255, 0, 0}
MainForm.Label1.FONTBOLD := .T.
lTracking := TrackMouseEvent(nHWnd, 0x00000002 /*TME_LEAVE*/)
ENDIF
EXIT
CASE WM_MOUSELEAVE
MainForm.Label1.FONTCOLOR := {0, 0, 0}
MainForm.Label1.FONTBOLD := .F.
lTracking := .F.
EXIT
ENDSWITCH
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"
HB_FUNC( TRACKMOUSEEVENT )
{
TRACKMOUSEEVENT tmi;
tmi.cbSize = sizeof(TRACKMOUSEEVENT);
tmi.dwFlags = hb_parni(2);
tmi.hwndTrack = (HWND) HMG_parnl(1);
tmi.dwHoverTime = HOVER_DEFAULT;
hb_retl(TrackMouseEvent(&tmi));
}
#pragma ENDDUMP
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: mouseover label
Hi,
Add SS_NOTIFY style to your Label definition
Hope that helps.
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Re: mouseover label
Hi, Grigory
In addition, this LABEL already has SS_NOTIFY style:
0x50800301 == WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTERIMAGE | SS_NOTIFY | SS_CENTER
There must be some other reason that WM_MOUSELEAVE is not received.
So applying SS_NOTIFY style should not affect the WM_MOUSELEAVE message generation.MSDN wrote: SS_NOTIFY
Sends the parent window STN_CLICKED, STN_DBLCLK, STN_DISABLE, and STN_ENABLE notification codes when the user clicks or double-clicks the control.
In addition, this LABEL already has SS_NOTIFY style:
0x50800301 == WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTERIMAGE | SS_NOTIFY | SS_CENTER
There must be some other reason that WM_MOUSELEAVE is not received.
Re: mouseover label
Hi,
You are right!
Please take a look for an updated sample below:
Code: Select all
#include "hmg.ch"
STATIC lTracking := .F.
FUNCTION Main()
DEFINE WINDOW MainForm;
WIDTH 300;
HEIGHT 200;
MAIN ;
ON MOUSEMOVE (MainForm.Label1.FONTCOLOR := {0, 0, 0}, MainForm.Label1.FONTBOLD := .F., lTracking := .F.)
DEFINE LABEL Label1
ROW 10
COL 10
WIDTH 140
HEIGHT 45
VALUE "This is LABEL"
ALIGNMENT Center
END LABEL
DEFINE BUTTON CloseButton
ROW 70
COL 10
WIDTH 80
HEIGHT 23
CAPTION "Close"
ACTION MainForm.RELEASE
END BUTTON
END WINDOW
HMG_ChangeWindowStyle(MainForm.Label1.HANDLE, 0x00800200 /*WS_BORDER|SS_CENTERIMAGE*/, NIL, .F., .T.)
EventCreate("LabelEventHandler", MainForm.Label1.HANDLE)
MainForm.CENTER
MainForm.ACTIVATE
RETURN NIL
FUNCTION LabelEventHandler()
LOCAL nHWnd := EventHWND()
LOCAL nMsg := EventMSG()
SWITCH nMsg
CASE WM_MOUSEMOVE
IF ! lTracking
MainForm.Label1.FONTCOLOR := {255, 0, 0}
MainForm.Label1.FONTBOLD := .T.
lTracking := TrackMouseEvent(nHWnd, 0x00000002 /*TME_LEAVE*/)
ENDIF
EXIT
CASE WM_MOUSELEAVE
MainForm.Label1.FONTCOLOR := {0, 0, 0}
MainForm.Label1.FONTBOLD := .F.
lTracking := .F.
EXIT
ENDSWITCH
RETURN NIL
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"
HB_FUNC( TRACKMOUSEEVENT )
{
TRACKMOUSEEVENT tmi;
tmi.cbSize = sizeof(TRACKMOUSEEVENT);
tmi.dwFlags = hb_parni(2);
tmi.hwndTrack = (HWND) HMG_parnl(1);
tmi.dwHoverTime = HOVER_DEFAULT;
hb_retl(TrackMouseEvent(&tmi));
}
#pragma ENDDUMP
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: mouseover label
Grigory
Yes, thank you for the idea.
This can also be done by processing WM_SETCURSOR message in main window event handler (example is here: viewtopic.php?f=9&t=4806&hilit=mouse+andyglez ).
But WM_MOUSELEAVE is still not received.
Why WM_MOUSELEAVE in HMG Extended works and in classic HMG doesn't work?
Yes, thank you for the idea.
This can also be done by processing WM_SETCURSOR message in main window event handler (example is here: viewtopic.php?f=9&t=4806&hilit=mouse+andyglez ).
But WM_MOUSELEAVE is still not received.
Why WM_MOUSELEAVE in HMG Extended works and in classic HMG doesn't work?