Text color on button

Post Reply
User avatar
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Text color on button

Post by TimStone »

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
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Text color on button

Post by Enrico Maria Giordano »

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
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Button

Post by TimStone »

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

Tim
Tim Stone
http://www.MasterLinkSoftware.com
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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/homepage ... rogram.htm

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

Post by Richard Chidiak »

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/homepage ... rogram.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
TimStone
Posts: 2536
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Contact:

Buttons

Post by TimStone »

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
timstone@masterlinksoftware.com
Using: FWH 19.06 with Harbour 3.2.0 / Microsoft Visual Studio Community 2019
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Buttons

Post by Enrico Maria Giordano »

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

Code: Select all

#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
Post Reply