FUNCTION OnMouseHover( hWnd, cFormName )

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by AUGE_OHR »

hi,

the Code "just" disable visual Style of Control with GetControlHandle(), not hole App or OS
so when have 10 Button you have to use it 10 x times while default all Controls, using Manifest, have visual Style.

---

under Xbase++ we have Property "UseVisualStyle" for each Control.
when set to .F. it just do Code which i have shown
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by andyglezl »

Tienes algún ejemplo que nos pudieras compartir para poderlo probar ?
*---------------------------------------------------------------------------------------
Do you have an example that you could share with us to try it out?
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by mol »

AUGE_OHR wrote: Tue Mar 31, 2020 4:41 am hi
andyglezl wrote: Mon Mar 30, 2020 8:58 pm In BUTTONS you cannot change the colors ...
this is true when have visual Style on (default)

you can disable Visual Style with

Code: Select all

   hwnd:= GetControlHandle( "Button_1", cForm)
   SetWindowTheme( hwnd, 0, 0 )
now you can use Color for Button
I've tried, not working...
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by AUGE_OHR »

hi,
mol wrote: Tue Mar 31, 2020 6:22 am I've tried, not working...
it "just" disable visual Style so how do you "Paint" Color :?:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by AUGE_OHR »

hi,

it work that Way with Label as it have BACKCOLOR but using "CREATE EVENT" seem me "limited"
we have

Code: Select all

  ON LOSTFOCUS	-> WM_KILLFOCUS
  ON GOTFOCUS 	-> WM_SETFOCUS
but it is not the same like

Code: Select all

  WM_MOUSELEAVE
  WM_MOUSEMOVE
  WM_MOUSEHOVER
those Windows Message are not used in h_windows.prg of HMG LIB.
when next Release of HMG include the Event and we must not work with a Workaround.

next Step would be to include WM_MEASUREITEM and WM_DRAWITEM with MEASUREITEM- and DRAWITEM-Structure and a "DrawItem" Codeblock Slot so User can "paint" what he want.

this is a Xbase++ Sample ( have no HMG Sample yet)
Hot_Button.gif
Hot_Button.gif (116.5 KiB) Viewed 2395 times
p.s. also WS_EX_ACCEPTFILES -> "DropZone" for each Control would be fine so we need no DragAcceptFiles()
have fun
Jimmy
User avatar
gfilatov
Posts: 1066
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by gfilatov »

AUGE_OHR wrote: Tue Mar 31, 2020 7:52 am ...
this is a Xbase++ Sample ( have no HMG Sample yet)
Hi,

Please be so kind to review the following Minigui sample also:
mousehover.png
mousehover.png (95.96 KiB) Viewed 2390 times
The source code is attached here (along with the compiled application) :arrow:
HTH 8-)
Attachments
ButtonHover.zip
(744.68 KiB) Downloaded 153 times
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by AUGE_OHR »

hi,

YES, MiniGUI use much more Events than HMG :!:

Code: Select all

ONMOUSEHOVER 
ONMOUSELEAVE
i´m still a harbour Newbie and have made my 1st Step with HMG.
now i can "walk" with HMG but to "run" with MiniGUI i still need time. ;)
have fun
Jimmy
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by mol »

AUGE_OHR wrote: Tue Mar 31, 2020 6:50 am hi,
mol wrote: Tue Mar 31, 2020 6:22 am I've tried, not working...
it "just" disable visual Style so how do you "Paint" Color :?:
I'm trying for one button in this way:
SetWindowTheme( OknoPartieProd.P_RozliczeniePartii.Handle, 0, 0 )
SetProperty("OknoPartieProd","P_RozliczeniePartii","FontColor", {255,0,0}) // colorize to red
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by AUGE_OHR »

hi,
mol wrote: Tue Mar 31, 2020 9:08 am SetProperty("OknoPartieProd","P_RozliczeniePartii","FontColor", {255,0,0}) // colorize to red
we talk about Button :?:
i don´t "see" in Help that Button have any Color Option so i ask for it.

---

HMG Syntax only work if API is behind.
under Xbase++ i use DLLCALL under harbour HB_FUNC()

this Sample i use to "paint" Darkmode (some Control have no Color Option)

Code: Select all

SetWindowTheme( OknoPartieProd.P_RozliczeniePartii.Handle, 0, 0 )
CONTROLBACKGROUND( OknoPartieProd.P_RozliczeniePartii.Handle, {255,0,0} )

HB_FUNC(CONTROLBACKGROUND)
{
   HWND hWnd;
   HDC  hDC;
   RECT rect;
   HBRUSH hbrush;
   PAINTSTRUCT ps;

   hWnd   = (HWND)    hb_parnl (1);
   GetClientRect(hWnd, &rect);
   hbrush = CreateSolidBrush( (COLORREF) RGB(hb_parvni(2, 1),
                                             hb_parvni(2, 2),
                                             hb_parvni(2, 3)) );
   hDC = BeginPaint (hWnd, &ps);
   FillRect(hDC,&rect,(HBRUSH) hbrush );
   ReleaseDC(hWnd, hDC);
}
have fun
Jimmy
User avatar
jairpinho
Posts: 420
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by jairpinho »

gfilatov wrote: Tue Mar 31, 2020 8:34 am
AUGE_OHR wrote: Tue Mar 31, 2020 7:52 am ...
this is a Xbase++ Sample ( have no HMG Sample yet)
Hi,

Please be so kind to review the following Minigui sample also:
mousehover.png
The source code is attached here (along with the compiled application) :arrow:
HTH 8-)
helo this is perfect!! but how to make it work in hmg without using buttonex? would have how to create a buttonex function in hmg to use
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
Post Reply