FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Trivial question
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Trivial question

Posted: Mon Jun 20, 2011 10:18 AM

Is it possible to change color text of a Button?

marco

Marco Boschi
info@marcoboschi.it
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: Trivial question

Posted: Mon Jun 20, 2011 10:51 AM
Marco,

there are 3 Button-classes :
TButton, TButtonBmp and TBtnBmp

@ 130, 20 BTNBMP oBtn1 OF oDlg ;
SIZE 70, 35 PIXEL 2007 ;
NOBORDER ;
PROMPT " Button 4" + CRLF + " Test" ;
FILENAME "..\bitmaps\16x16\garrow.bmp" ;
ACTION oDlg:End() ;
FONT oFont1 ;
LEFT
oBtn1:lTransparent := .t.
oBtn1:cToolTip = { "Title " + CRLF + "BMP","BMP Select", 1, CLR_BLACK, 14089979 }
oBtn1:SetColor( 128, )

Button-Textcolor
--------------------
oBtn1:SetColor( 128 ) // Red

Button-tooltip
----------------
oBtn1:cToolTip := { " " + CRLF + ;
"Button 1", "C o l o r ", 1, 0, 128 }


change Buttontext at Runtime
-----------------------------------
oBtn1 = {|| oWnd:SetText( ""Button 1" ) }

Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Re: Trivial question

Posted: Mon Jun 20, 2011 12:39 PM

Uwe,
Im' talking about tButton

REDEFINE BUTTON  oButFil   PROMPT "Test"  ID 205 OF oDlg

I want that Test string is blue, for instance

Marco Boschi
info@marcoboschi.it
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: Trivial question

Posted: Mon Jun 20, 2011 01:39 PM

Marco,

as far as I know, there is no Textcolor-support for Class TButton.
I tested something from TControl, but it is ignored.
Maybe a Solution using Skins ?

Best Regards
Uwe :(

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM

Re: Trivial question

Posted: Mon Jun 20, 2011 04:12 PM

Uwe,
I have a twbrowse list.
When I filter database I change the color from black to blue.
It seems intuitive to write "Filter" in blue in the button that filter twbrowse

Many thanks

marco

Marco Boschi
info@marcoboschi.it
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM

Re: Trivial question

Posted: Mon Jun 20, 2011 06:43 PM
Marco,

Buttonskins could be maybe a Solution ?
We still need a => oSkinB:aClrLostFocused <= !
Changing the Focus to xBrowse, the blue Button changes back to Lightblue.

Testing Skin-buttons :



Code (fw): Select all Collapse
oSkinB :=  TSkinButton():New()
oSkinB:nClrBorder0_N := 0
oSkinB:nClrBorder1_N := 1
oSkinB:aClrNormal := { { 0.50, 16771797, 16777215 }, ;
                { 0.50, 16777215, 16771797 } }
oSkinB:aClrFocused := { { 0.50, 14130233, 16777215 }, ;
                { 0.50, 16777215, 14130233 } }
oSkinB:aClrPressed := { { 0.50, 12171775, 16777215 }, ;
                { 0.50, 16777215, 12171775 } }
SkinButtons( oSkinB )


Best Regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM

Re: Trivial question

Posted: Tue Jun 21, 2011 07:46 AM

Marco,

Windows Api does not allow to change the textcolor of a windows-button.

But you can use tsbutton instead. Here you can change the texcolor and the buttoncolor. The look of these buttons does not differ from the windows buttons

kind regards

Stefan

Continue the discussion