Change color of say when mouse is over it

Change color of say when mouse is over it

Postby Dietmar Jahnel » Sat May 16, 2009 5: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: Select all  Expand view

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
User avatar
Dietmar Jahnel
 
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria

Re: Change color of say when mouse is over it

Postby Otto » Sat May 16, 2009 7:32 pm

Hello Dietmar,
you could try with lWantClick.
Best regards,
Otto


Code: Select all  Expand view

   oSay:lWantClick := .t.
   oSay:bMMoved   = {||oSay:SetColor(  0, RGB(128,128,255) ),   oSay:refresh() }
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Change color of say when mouse is over it

Postby Dietmar Jahnel » Sun May 17, 2009 7:36 am

Code: Select all  Expand view

   oSay:lWantClick := .t.
   oSay:bMMoved   = {||oSay:SetColor(  0, RGB(128,128,255) ),   oSay:refresh() }
 
[/quote]

Sorry, but the color does not change...
Dietmar
User avatar
Dietmar Jahnel
 
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria

Re: Change color of say when mouse is over it

Postby Otto » Sun May 17, 2009 8: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Change color of say when mouse is over it

Postby Dietmar Jahnel » 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
User avatar
Dietmar Jahnel
 
Posts: 83
Joined: Mon Oct 17, 2005 10:33 am
Location: Austria

Re: Change color of say when mouse is over it

Postby Otto » Sun May 17, 2009 2: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: Select all  Expand view
// 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
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Re: Change color of say when mouse is over it

Postby nageswaragunupudi » Sun May 17, 2009 3:26 pm

Not very elegant, but this works.
Code: Select all  Expand view

#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
User avatar
nageswaragunupudi
 
Posts: 10624
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 64 guests

cron