Page 1 of 1

BtnBmp New DATA aPromptClrs

PostPosted: Mon Sep 05, 2011 10:49 pm
by Bayron
Basically I want to have a Color of Text Set for events, similar to what cBmpFile1, cBmpFile2, cBmpFile3 and cBmpFile4 do, but even if only one Bmp file is set.
This way, if I set only one BMP, I still have the effect of something changing in the button when an event happens (Button Enabled, Mouse Over, Button Pressed, Button Disabled...

I think METHOD SetColor( nClrText, nClrPane ) can be used for that effect....

I am planning to Update some time the beginning of next year, but I will like to have something done before that, I think the class can be modified rather easily by some one with CLASS programming experience, I will try to do my self, but I don't want to corrupt the class, If someone can help, I think it may be of benefit for everyone.... Thanks!!!

Re: BtnBmp New DATA aPromptClrs

PostPosted: Tue Sep 06, 2011 6:54 pm
by Bayron
I was able to obtain what I wanted, harcoding the following lines:

Code: Select all  Expand view
254    ::SetColor( If( ValType( ::nClrText ) == "B", Eval( ::nClrText, ::lMOver ), if( !::lMOver .and. !Empty( ::cCaption ), If( ::lCalcColor = .t. , ::nClrText := CLR_BLACK , ::nClrText := CLR_WHITE ), If( ::lPressed .and. !Empty( ::cCaption ) , ::nClrText := CLR_HRED , If( ::lCalcColor = .t. , ::nClrText := CLR_YELLOW , ::nClrText := CLR_HGREEN ) ) ) ), ::nClrPane )

357   ::SetColor( If( ValType( ::nClrText ) == "B", Eval( ::nClrText, ::lMOver ), if( !::lMOver .and. !Empty( ::cCaption ), If( ::lCalcColor = .t. , ::nClrText := CLR_BLACK , ::nClrText := CLR_WHITE ), If( ::lPressed .and. !Empty( ::cCaption ) , ::nClrText := CLR_HRED , If( ::lCalcColor = .t. , ::nClrText := CLR_YELLOW , ::nClrText := CLR_HGREEN ) ) ) ), ::nClrPane )

500   ::SetColor( If( ValType( ::nClrText ) == "B", Eval( ::nClrText, ::lMOver ), if( !::lMOver .and. !Empty( ::cCaption ), If( ::lCalcColor = .t. , ::nClrText := CLR_BLACK , ::nClrText := CLR_WHITE ), If( ::lPressed .and. !Empty( ::cCaption ) , ::nClrText := CLR_HRED , If( ::lCalcColor = .t. , ::nClrText := CLR_YELLOW , ::nClrText := CLR_HGREEN ) ) ) ), ::nClrPane )

1287  If( ValType( ::nClrText ) == "B", Eval( ::nClrText, ::lMOver ), if( !::lMOver .and. !Empty( ::cCaption ), If( ::lCalcColor = .t. , ::nClrText := CLR_BLACK , ::nClrText := CLR_WHITE ), If( ::lPressed .and. !Empty( ::cCaption ) , ::nClrText := CLR_HRED , If( ::lCalcColor = .t. , ::nClrText := CLR_YELLOW , ::nClrText := CLR_HGREEN ) ) ) ), ::hDC,;

1311  If( ValType( ::nClrText ) == "B", Eval( ::nClrText, ::lMOver ), if( !::lMOver .and. !Empty( ::cCaption ), If( ::lCalcColor = .t. , ::nClrText := CLR_BLACK , ::nClrText := CLR_WHITE ) , If( ::lPressed .and. !Empty( ::cCaption ) , ::nClrText := CLR_HRED ,  If( ::lCalcColor = .t. , ::nClrText := CLR_YELLOW , ::nClrText := CLR_HGREEN ) ) ) ), ::hDC,;

1318  nClr = If( IsWindowEnabled( ::hWnd ), if( !::lMOver .and. !Empty( ::cCaption ), If( ::lCalcColor = .t. , ::nClrText := CLR_BLACK , ::nClrText := CLR_WHITE ), If( ::lPressed .and. !Empty( ::cCaption ) , ::nClrText := CLR_HRED , If( ::lCalcColor = .t. , ::nClrText := CLR_YELLOW , ::nClrText := CLR_HGREEN ) ) ), if( ::lDisColor, CLR_HGRAY, ::nClrTextDis ) )

1172  nClr = If( IsWindowEnabled( ::hWnd ), if( !::lMOver .and. !Empty( ::cCaption ), If( ::lCalcColor = .t. , ::nClrText := CLR_BLACK , ::nClrText := CLR_WHITE ), If( ::lPressed .and. !Empty( ::cCaption ) , ::nClrText := CLR_HRED , If( ::lCalcColor = .t. , ::nClrText := CLR_YELLOW , ::nClrText := CLR_HGREEN ) ) ), if( ::lDisColor, CLR_HGRAY , ::nClrTextDis ) )


::lCalcColor is a DATA I added to have a diferent color for the button where ::lCalcColor = .t.

It looks great....
Image

I hope it will be SOFTCODED and included in a next Fivewin release before next year, something like

Code: Select all  Expand view
@ 10, 10 BTNBMP oBtn OF oDialog FILENAME "Boton.bmp" PROMPT "Boton1" PROMPTCOLORS ColorActive, ColorMouseOver, ColorPressed, ColorDissabled FONT oFont1
 


THANKS FOR THAKING THIS UNTO CONSIDERATION...

Re: BtnBmp New DATA aPromptClrs

PostPosted: Sat Jun 23, 2012 3:37 am
by Bayron
Just in case it can be included in FiveWin, I made changes to btnbmp.prg FWH12.04
Image

New Datas:

nClrActive
nClrMouseOver
nClrPressed
nClrDisabled


I sent you the modified class by e-mail...