Text color on button

Text color on button

Postby TimStone » Sat Feb 18, 2006 2:06 am

How can we change the color of a text item on a button ?

I have a calendar and I want some days ( no appointments ) in grey, while days with activity I want shown in blue. Finally, the current day needs to stand out in red.

The buttons are stored in a two dimensional array.

The problem is that I'm having difficulty changing the text color on the button.

Must be old age ....

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Text color on button

Postby Enrico Maria Giordano » Sat Feb 18, 2006 12:44 pm

TimStone wrote:How can we change the color of a text item on a button ?


You can't change the colors of a TButton (standard Windows pushbuttons). Try using a TBtnBmp instead (or maybe a TButtonBmp but I'm not sure).

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Button

Postby TimStone » Sat Feb 18, 2006 6:14 pm

OK ... so I'm not losing my mind. Thanks ...

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Postby James Bott » Sat Feb 18, 2006 8:20 pm

Tim,

TSButton has a setColor() method, but I have never tried it.

TSButton is included in TSBrowse, and you can get a copy on my website on this page:

http://ourworld.compuserve.com/homepages/jbott/program.htm

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Richard Chidiak » Sat Feb 18, 2006 9:50 pm

James Bott wrote:Tim,

TSButton has a setColor() method, but I have never tried it.

TSButton is included in TSBrowse, and you can get a copy on my website on this page:

http://ourworld.compuserve.com/homepages/jbott/program.htm

James


Tsbutton works OK with Setcolor, i use it in my app

here is a working sample

REDEFINE SBUTTON FILE DIRAPPLI() + "BMP\AIDE.BMP" ID 301 of Odlg ;
TOOLTIP "Aide" ;
COLORS CLR_WHITE, ;
{|oB| If( oB:lMouseOver, {CLR_WHITE,CLR_BLUE }, ;
{CLR_BLUE,CLR_WHITE} ) } ;
ROUNDRECT TEXT POSITION ON_RIGHT CANCEL ;
ACTION DETHELP("CAISSPAR")

Tim, if you need the xbp file to build the tsbutton library, let me know

Richard
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Buttons

Postby TimStone » Sun Feb 19, 2006 6:48 pm

I was able to use BTNBMP to do what I want, and I changed the background to a bitmap.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2945
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Buttons

Postby Enrico Maria Giordano » Sun Feb 19, 2006 7:46 pm

You can even use SetColor() method without using a bitmap:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBtn

    LOCAL cVar := SPACE( 20 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar;
           VALID !EMPTY( cVar )

    @ 30, 10 BTNBMP oBtn PROMPT "Close";
             ACTION oDlg:End()

    oBtn:SetColor( CLR_RED, CLR_YELLOW )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests