Page 1 of 1

SAY - Detecting mouse leaving

Posted: Wed Jun 21, 2006 6:01 am
by James Bott
I can use oSay:bMMove to force the font to be changed when the cursor is over the SAY, but how can I then detect that the mouse is no longer over the SAY so I can change the font back. I am trying to make the font change to underlined when the mouse is over it, then change it back after.

I have tried a bunch of things with no success.

James

Re: SAY - Detecting mouse leaving

Posted: Wed Jun 21, 2006 9:42 am
by Enrico Maria Giordano
Check tooltip management in TWindow.

EMG

Posted: Wed Jun 21, 2006 11:54 am
by James Bott
Enrico,

I already looked at tooltips in TWindow. A tooltip is displayed with a timer so it is hidden after the timer expires. Then the tooltip is ended in the LostFocus() method, but TSay never gets focus so it never looses focus.

James

Posted: Wed Jun 21, 2006 12:18 pm
by Enrico Maria Giordano
No, a timer is used only in Clipper/FW (16 bit). Please note the #ifdef directive.

Have a look at TMsgBar:MouseMove() method and at TWindow:lButtonUp() method (specifically the call to oWnd:NcMouseMove()).

EMG

Posted: Wed Jun 21, 2006 2:30 pm
by Gale FORd
TSButton does it by using a transparent button.

Posted: Sun Jun 25, 2006 12:51 pm
by manuramos
Try This:

First declare oSay:Cargo := .F.
and oSay:bMMoved := { |nRow, nCol| MyFuncionMoved(nRow, nCol, oSay) }.
This function must be some thing like this:

>FUNCTION MyFuncionMoved(nRow, nCol, oSay)
> IF !oSay:Cargo
> ...
> HOW I WANT TO DO WHEN MOUSE ENTER UP THE SAY
> CHANGE oSay COLOUR, MOUSE, FONT, ETC...
> ...
> oSay:Cargo := .T.
> SetCapture(oSay:hWnd) // TAKE MOUSE CONTROL
> *
> ELSEIF oSay:Cargo .AND. !IsOverWnd( oSay:hWnd, nRow, nCol )
> ...
> HOW I WANT TO DO WHEN MOUSE LEAVE THE SAY
> RESTORE oSay COLOUR, MOUSE, FONT, ETC...
> ...
> oSay:Cargo := .F.
> ReleaseCapture() // RELEASE MOUSE CONTROL
> *
> ENDIF
>RETURN NIL

To change the oSay Colours I do

oSay:SetColor(nClrTexto,nClrFondo)
oSay:SetText(oSay:cCaption)

Without the second line, oSay's colours don't change (FW 2.3 y Clipper 5.3).
(Excuse my English)
Good Luck

Posted: Tue Jun 27, 2006 7:24 am
by Detlef Hoefner
Hi all,

i'm also very interested about detecting a mouse move over a get.
So i tried your suggestions. But without success.

here my code:

Code: Select all

#include "FiveWin.ch"

////////////////
PROCEDURE Main()
////////////////
LOCAL oDlg, oSay
LOCAL cSay := "This is a Say Text"

   

   DEFINE DIALOG oDlg;
          FROM 5, 5 TO 15, 40;
          TITLE " MouseMove Test"

   @ 2, 4 SAY oSay VAR cSay SIZE 100, 10 OF oDlg BORDER CENTER
   oSay:bMMoved := { | nRow, nCol | MsgAlert( "HI" ) }

   @ 3, 9 BUTTON "E&xit" OF oDlg SIZE 40, 11 ;
          ACTION oDlg:End()

   ACTIVATE DIALOG oDlg

RETURN
When running this little program nothing happens when touching the oSay with my mouse.
I use latest xHarbour Bilder and the most recent FwH 2.7.
Am i missing something?

Regards,
Detlef

Posted: Tue Jun 27, 2006 10:55 am
by Enrico Maria Giordano
Add

Code: Select all

oSay:lWantClick = .T.
EMG

Posted: Tue Jun 27, 2006 11:18 am
by Detlef Hoefner
Hello Enrico,

yes, it works now.
I think you are eating every morning FiveWin internals with a big spoon. :wink:

BTW:
I visited your website. And i suddenly remembered having an exciting time with playing 'Jet Set Willy' on my very first computer which was a Sinclair Spectrum ( a black one ).

Those were the days where programmers had to care about limited memory space, wasting no byte and producing amazing applications.

Thanks again for your help.
Regards,
Detlef

Posted: Tue Jun 27, 2006 11:38 am
by Enrico Maria Giordano
Detlef Hoefner wrote:Hello Enrico,

yes, it works now.
I think you are eating every morning FiveWin internals with a big spoon. :wink:
:-)))
Detlef Hoefner wrote:BTW:
I visited your website. And i suddenly remembered having an exciting time with playing 'Jet Set Willy' on my very first computer which was a Sinclair Spectrum ( a black one ).
Many programmers have their roots in the little black box, at least here in Europe. :-)
Detlef Hoefner wrote:Those were the days where programmers had to care about limited memory space, wasting no byte and producing amazing applications.
Yes. I started with Sinclair ZX81 that featured one big Kb of RAM :-)

EMG