How to make a "hoover" effect ?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

How to make a "hoover" effect ?

Post by Ricci » Tue Dec 15, 2009 4:57 pm

I like to open a small popup window if someone goes with the mousecursor over a bottom without clicking it.

There is no event for it. So i thought it would work using the ONMOUSEMOVE in the windows definition, extracting the mouse position (no function for that ???) and creating/deleting the popup:

Code: Select all

	DEFINE WINDOW Form_1 ;
		ON MOUSEMOVE test()  .....

	@ 540,460 BUTTON ButtonBluete ;
			  PICTURE "bbluete" ;
			  WIDTH 29 HEIGHT 30 FLAT 
        .....

	function test()
		LOCAL nMouseRow := _HMG_SYSDATA [ 191 ]
		LOCAL nMouseCol := _HMG_SYSDATA [ 192 ]
		
		IF nMouseRow >= Form_1.ButtonBluete.Row .AND. nMouseRow <= Form_1.ButtonBluete.Row + 28 .AND. ;   
			nMouseCol >= Form_1.ButtonBluete.Col .AND. nMouseCol <= Form_1.ButtonBluete.Col + 29
			
			// popup window
		ELSE
			// close window
		ENDIF
	Return Nil
But that didn´t work well. Only if the mouse cursor enters the button from the right side it works (sometimes). Strange. So i think _HMG_SYSDATA [ 191 ] and _HMG_SYSDATA [ 192 ] doesn´t reflect the actual mouse position.

Any way to make that easier and working ?

Regards ... Ricci

User avatar
gfilatov
Posts: 623
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Has thanked: 22 times
Been thanked: 190 times
Contact:

Post by gfilatov » Wed Dec 16, 2009 9:17 am

Hello Ricci,

Please take a look for the following small sample:

Code: Select all

/*
 * MINIGUI - Harbour Win32 GUI library Demo
 *
 * Copyright 2002-2009 Roberto Lopez <harbourminigui@gmail.com>
 * http://harbourminigui.googlepages.com/
 *
 * MOUSEMOVE demo
 * (C) 2006 Jacek Kubica <kubica@wssk.wroc.pl> 
*/

#include "MiniGUI.ch"

Procedure main()

DEFINE WINDOW Form_1 ;
	AT 0,0 ;
	WIDTH 348 ;
	HEIGHT 176 ;
	MAIN ;
	TITLE "Mouse Test" ;
	ON MOUSEMOVE DisplayCoords()


END WINDOW

CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1

Return

*--------------------------
Procedure DisplayCoords()
*--------------------------
Local aCoords:={}

	aCoords := GETCURSORPOS()
	Form_1.Title:= "Pos y: "+ PADL(aCoords[1]-Form_1.Row-GetTitleHeight()-GetBorderHeight(), 4) + ;
		" Pos x: "+ PADL(aCoords[2]-Form_1.Col-GetBorderWidth(), 4)
Return
I hope that give you the ideas :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Post by Ricci » Wed Dec 16, 2009 9:46 am

gfilatov wrote:Hello Ricci,

Please take a look for the following small sample:
....

I hope that give you the ideas :idea:
Thank you Grigory.

But it didn´t work as expected, it shows the same problem like my code before.
And i found out why: "ON MOUSEMOVE" only works when the cursor is not over a control (textbox, browse, button, ...).

Not really what i wanted. Perhaps this happens because HMG gives all the control to the Windows system? Too bad for my idea ....

We need a "ON MOUSEOVER" property for each control like the "ON GOTFOCUS". <-- Roberto :?:


Regards ... Ricci

Post Reply