FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Text color on button
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Text color on button
Posted: Sat Feb 18, 2006 02: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Text color on button
Posted: 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
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Button
Posted: Sat Feb 18, 2006 06: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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Text color on button
Posted: Sat Feb 18, 2006 08: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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Text color on button
Posted: Sat Feb 18, 2006 09: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
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Buttons
Posted: Sun Feb 19, 2006 06: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Buttons
Posted: Sun Feb 19, 2006 07:46 PM
You can even use SetColor() method without using a bitmap:

#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

Continue the discussion