Page 1 of 1
Text color on button
Posted: Sat Feb 18, 2006 2:06 am
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
Re: Text color on button
Posted: Sat Feb 18, 2006 12:44 pm
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
Button
Posted: Sat Feb 18, 2006 6:14 pm
by TimStone
OK ... so I'm not losing my mind. Thanks ...
Tim
Posted: Sat Feb 18, 2006 8:20 pm
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
Posted: Sat Feb 18, 2006 9:50 pm
by Richard Chidiak
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
Buttons
Posted: Sun Feb 19, 2006 6:48 pm
by TimStone
I was able to use BTNBMP to do what I want, and I changed the background to a bitmap.
Tim
Re: Buttons
Posted: Sun Feb 19, 2006 7:46 pm
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