FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Change color of say when mouse is over it
Posts: 83
Joined: Mon Oct 17, 2005 10:33 AM
Change color of say when mouse is over it
Posted: Sat May 16, 2009 05:28 PM
Antonio,
is there a way to change the color of the text of a say-object when the mouse is moved over it and the cursor changes to HAND?

I did this for years with an old class called sensitive say:

Code (fw): Select all Collapse
REDEFINE SENSITIVE SAY geSay2 ID 903 of SuchFolder:aDialogs[2];
         COLOROVER RGB( 128, 0, 0 );
         BOX TRANSPARENT;
         ACTION (HelpTopic(IDH_SM_CHECK))


But now in Vista the transparent painting with this old class does not work any more.

Thanks for help,
Dietmar
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Change color of say when mouse is over it
Posted: Sat May 16, 2009 07:32 PM
Hello Dietmar,
you could try with lWantClick.
Best regards,
Otto


Code (fw): Select all Collapse
   oSay:lWantClick := .t.
   oSay:bMMoved   = {||oSay:SetColor(  0, RGB(128,128,255) ),   oSay:refresh() }
Posts: 83
Joined: Mon Oct 17, 2005 10:33 AM
Re: Change color of say when mouse is over it
Posted: Sun May 17, 2009 07:36 AM
Code (fw): Select all Collapse
   oSay:lWantClick := .t.
   oSay:bMMoved   = {||oSay:SetColor(  0, RGB(128,128,255) ),   oSay:refresh() }


Sorry, but the color does not change...
Dietmar
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Change color of say when mouse is over it
Posted: Sun May 17, 2009 08:59 AM
Dietmar,
what version of FW do you use?
Do you have this line in Say class:


METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TSay

if ... nMsg == WM_NCHITTEST ) // To have a standard behavior on Clicks


Best regards,
Otto
Posts: 83
Joined: Mon Oct 17, 2005 10:33 AM
Re: Change color of say when mouse is over it
Posted: Sun May 17, 2009 10:36 AM
Otto wrote:Dietmar,
what version of FW do you use?

latest: 9.04

Do you have this line in Say class:


METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TSay

if ... nMsg == WM_NCHITTEST ) // To have a standard behavior on Clicks


yes.
Do you get the color change?

Grüße,
Dietmar
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Change color of say when mouse is over it
Posted: Sun May 17, 2009 02:22 PM
Hello Dietmar,
yes. As soon as you move the mouse on the control the event is fired and it works.
I only don’t know – there are many ways – what would be the best way and when to change the color back to the original.
I have version 9.02 but I don’t think there was another change in the class.
Best regards,
Otto



Code (fw): Select all Collapse
// A sample showing to to let a SAY accept Clicks events

#include "FiveWin.ch"
#define COLOR_BTNFACE       15
function Main()
   local oDlg, oSay, oCursor
   DEFINE CURSOR oCursor HAND
   DEFINE DIALOG oDlg
   @ 2, 2 SAY oSay PROMPT "Test"
   oSay:lWantClick = .t.
   oSay:bMMoved   = {|| oSay:SetColor(  0, RGB(128,128,255) ),   oSay:refresh() }
   oSay:oCursor    = oCursor

   ACTIVATE DIALOG oDlg CENTERED

return nil
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Change color of say when mouse is over it
Posted: Sun May 17, 2009 03:26 PM
Not very elegant, but this works.
Code (fw): Select all Collapse
 
#include "urllink.ch"

.....
< other code >
  
@   40, 20 URLLINK oSay URL 'This is a say' ;
      PIXEL OF oWnd CLROVER CLR_HRED FONT oFont

<other code>

Probably a better way would be to derive a class from TUrlLink, with more features for mouseover, like change of font, change of background and foreground colors, attach an action block on click, etc. Or write a class derived from TSay with similar features
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion