Trivial question

Trivial question

Postby MarcoBoschi » Mon Jun 20, 2011 10:18 am

Is it possible to change color text of a Button?

marco
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Trivial question

Postby ukoenig » 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 :lol:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Trivial question

Postby MarcoBoschi » 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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Trivial question

Postby ukoenig » Mon Jun 20, 2011 1: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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Trivial question

Postby MarcoBoschi » Mon Jun 20, 2011 4: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
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Trivial question

Postby ukoenig » Mon Jun 20, 2011 6: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 :

Image

Code: Select all  Expand view

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Trivial question

Postby StefanHaupt » Tue Jun 21, 2011 7: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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests