FUNCTION OnMouseHover( hWnd, cFormName )

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

FUNCTION OnMouseHover( hWnd, cFormName )

Post by andyglezl »

Hola
Aquí les dejo la Función (adaptada): FUNCTION OnMouseHover( hWnd, cFormName )
para poderla utilizar en varias definiciones de ventanas. Ejemplos...
*-------------------------------------------------------------------------------------------------------------------
Hi
Here is the Function (adapted): FUNCTION OnMouseHover (hWnd, cFormName)
so that it can be used in various window definitions. Examples ...


*--------------------------------------------------------------------------------------------------------
DEFINE WINDOW FormMain AT 0 , 0 WIDTH 1024 HEIGHT 570 MAIN NOSYSMENU BACKCOLOR BLUE TITLE " M E S A S "
..........
END WINDOW
CENTER WINDOW FormMain
CREATE EVENT PROCNAME OnMouseHover( EventWPARAM(), "FormMain" ) HWND FormMain.Handle
ACTIVATE WINDOW FormMain
*--------------------------------------------------------------------------------------------------------
DEFINE WINDOW Form_Labels AT 0,0 WIDTH 665 HEIGHT 610 TITLE 'LABEL DEMO' CHILD BACKCOLOR GRAY
..........
END WINDOW
CENTER WINDOW Form_Labels
CREATE EVENT PROCNAME OnMouseHover( EventWPARAM(), "Form_Labels" ) HWND Form_Labels.Handle
ACTIVATE WINDOW Form_Labels
*--------------------------------------------------------------------------------------------------------

Code: Select all

FUNCTION OnMouseHover( hWnd, cFormName )	// Funciona para utilizar en varias FORMAS
	LOCAL cControl := "", cForm := ""
	
	GetControlNameByHandle( hWnd, @cControl, @cForm )
	IF EMPTY( cControl ) .OR. GetControlType( cControl, cForm ) <> "LABEL"					// Validar solo Control LABEL
		RETURN
	ENDIF
	SetProperty( cForm, "Title", cFormName + " - " + cControl )								// Para saber donde estoy... Quitar luego
	DO CASE
		CASE cFormName == "FormMain"
			IF ! EMPTY( cPrevious1 )														// cPrevious1 definido como PRIVATE en MAIN
				IF ! ( cControl == cPrevious1 )
					SetProperty( cFormName, cPrevious1, "BackColor", WHITE )				// El mismo Color como se definió
					SetProperty( cFormName, cPrevious1, "FontColor", BLACK )				// El mismo Color como se definió
				ELSE
					SetProperty( cFormName, cPrevious1, "BackColor", { 173 , 255 , 47 } )
					SetProperty( cFormName, cPrevious1, "FontColor", BLUE )
				ENDIF
			ENDIF
			cPrevious1 := cControl
		CASE cFormName == "Form_Labels"
			IF ! EMPTY( cPrevious2 )														// cPrevious2 definido como PRIVATE en MAIN
				IF ! ( cControl == cPrevious2 )
					SetProperty( cFormName, cPrevious2, "BackColor", { 65 , 105 , 225 } )	// El mismo Color como se definió
					SET CONTROL &cPrevious2 OF &cFormName NOTEDGE	// STATICEDGE
				ELSE
					SetProperty( cFormName, cPrevious2, "BackColor", BLUE )
					SET CONTROL &cPrevious2 OF &cFormName CLIENTEDGE
				ENDIF
			ENDIF
			cPrevious2 := cControl
	ENDCASE
RETURN
Mesas.gif
Mesas.gif (605.37 KiB) Viewed 3181 times


Hay que estar activos mientras estamos en cuarentena...
*----------------------------------------------------------------------------
We must be active while we are in quarantine ...
Andrés González López
Desde Guadalajara, Jalisco. México.
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 »

fantastic great job, congratulations thanks for sharing
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
User avatar
mustafa
Posts: 1160
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by mustafa »

Hola Andrés
Como siempre , fantastico
Saludos
Mustafa
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by serge_girard »

cPrevious1 needs to be initialized:

Code: Select all

 
PUBLIC cPrevious1 := ''
 
Serge
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3166
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: FUNCTION OnMouseHover( hWnd, cFormName )

Post by serge_girard »

and cPrevious2 too!
There's nothing you can do that can't be done...
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 »

Si
Lo siento, no traduje el comentario.
*---------------------------------------------
Yes
Sorry, I didn't translate the comment.


IF ! EMPTY( cPrevious1 ) // cPrevious1 definido como PRIVATE en MAIN

// cPrevious1 defined as PRIVATE in MAIN
Andrés González López
Desde Guadalajara, Jalisco. México.
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 »

andyglezl wrote: Fri Mar 27, 2020 10:52 pm Hola
Aquí les dejo la Función (adaptada): FUNCTION OnMouseHover( hWnd, cFormName )
para poderla utilizar en varias definiciones de ventanas. Ejemplos...
*-------------------------------------------------------------------------------------------------------------------
Hi
Here is the Function (adapted): FUNCTION OnMouseHover (hWnd, cFormName)
so that it can be used in various window definitions. Examples ...


*--------------------------------------------------------------------------------------------------------
DEFINE WINDOW FormMain AT 0 , 0 WIDTH 1024 HEIGHT 570 MAIN NOSYSMENU BACKCOLOR BLUE TITLE " M E S A S "
..........
END WINDOW
CENTER WINDOW FormMain
CREATE EVENT PROCNAME OnMouseHover( EventWPARAM(), "FormMain" ) HWND FormMain.Handle
ACTIVATE WINDOW FormMain
*--------------------------------------------------------------------------------------------------------
DEFINE WINDOW Form_Labels AT 0,0 WIDTH 665 HEIGHT 610 TITLE 'LABEL DEMO' CHILD BACKCOLOR GRAY
..........
END WINDOW
CENTER WINDOW Form_Labels
CREATE EVENT PROCNAME OnMouseHover( EventWPARAM(), "Form_Labels" ) HWND Form_Labels.Handle
ACTIVATE WINDOW Form_Labels
*--------------------------------------------------------------------------------------------------------

Code: Select all

FUNCTION OnMouseHover( hWnd, cFormName )	// Funciona para utilizar en varias FORMAS
	LOCAL cControl := "", cForm := ""
	
	GetControlNameByHandle( hWnd, @cControl, @cForm )
	IF EMPTY( cControl ) .OR. GetControlType( cControl, cForm ) <> "LABEL"					// Validar solo Control LABEL
		RETURN
	ENDIF
	SetProperty( cForm, "Title", cFormName + " - " + cControl )								// Para saber donde estoy... Quitar luego
	DO CASE
		CASE cFormName == "FormMain"
			IF ! EMPTY( cPrevious1 )														// cPrevious1 definido como PRIVATE en MAIN
				IF ! ( cControl == cPrevious1 )
					SetProperty( cFormName, cPrevious1, "BackColor", WHITE )				// El mismo Color como se definió
					SetProperty( cFormName, cPrevious1, "FontColor", BLACK )				// El mismo Color como se definió
				ELSE
					SetProperty( cFormName, cPrevious1, "BackColor", { 173 , 255 , 47 } )
					SetProperty( cFormName, cPrevious1, "FontColor", BLUE )
				ENDIF
			ENDIF
			cPrevious1 := cControl
		CASE cFormName == "Form_Labels"
			IF ! EMPTY( cPrevious2 )														// cPrevious2 definido como PRIVATE en MAIN
				IF ! ( cControl == cPrevious2 )
					SetProperty( cFormName, cPrevious2, "BackColor", { 65 , 105 , 225 } )	// El mismo Color como se definió
					SET CONTROL &cPrevious2 OF &cFormName NOTEDGE	// STATICEDGE
				ELSE
					SetProperty( cFormName, cPrevious2, "BackColor", BLUE )
					SET CONTROL &cPrevious2 OF &cFormName CLIENTEDGE
				ENDIF
			ENDIF
			cPrevious2 := cControl
	ENDCASE
RETURN

Mesas.gif



Hay que estar activos mientras estamos en cuarentena...
*----------------------------------------------------------------------------
We must be active while we are in quarantine ...
it is possible with button
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br
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 »

En los BUTTONS no se pueden cambiar los colores, solo que sea: FONT, SIZE, BOLD ...
*---------------------------------------------------------------------------------------------------------
In BUTTONS you cannot change the colors, only that it is: FONT, SIZE, BOLD ...


Puedes probar cambiando:
*-------------------------------------
You can try changing:

Code: Select all

	IF EMPTY( cControl ) .OR. GetControlType( cControl, cForm ) <> "BUTTON"
		RETURN
	ENDIF
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2062
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
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
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 »

Hola Jimmy
En lo personal, yo si podría cambiar el estilo visual de mi PC, pero, (siempre hay un "pero")
hay clientes que no permiten que se les cambie. Y ya me ha pasado, que cuando modificas algo,
lo siguiente que falla, es porque "tu" causaste el problema... no se si a ustedes les pase diferente.
Prefiero no utilizar este tipo de cambios. (pero gracias por el tip)
*-----------------------------------------------------------------------------------------------------------------------------
Hi jimmy
Personally, I could change the visual style of my PC, but, (there is always a "but")
There are clients who do not allow them to be changed. And it has already happened to me,
that when you modify something, The next thing that fails is because "you" caused the problem ...
I don't know if it happens to you differently. I prefer not to use these kinds of changes.
(but thanks for the tip)
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply