I am new to FireFly and am using FireFly trial version.
I want to be able to change color and text of a command button. For testing purposes I have added one RRButton to a Form and am trying to change color and text on button click.
Changing the text seems to work, but changing color does not work. I tried FF_Control_Redraw after setting new color without any effect. I also tried hiding the control, then doing FF_Control_SetColor, and then using show command.
In the beginning, RRbutton is color Red with text "Connect". After clicking I want RRButton to have color Green and text "Connected"
Below is the code:
Function FORM1_RRBUTTON1_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
FF_Control_SetText (HWND_FORM1_RRBUTTON1,"Connected")
' FF_Control_ShowState (HWND_FORM1_RRBUTTON1,%SW_HIDE)
FF_Control_SetColor (HWND_FORM1_RRBUTTON1,-1,%Green)
' FF_Control_ShowState (HWND_FORM1_RRBUTTON1,%SW_SHOW)
FF_Control_Redraw (HWND_FORM1_RRBUTTON1)
End Function
Thanks for the help.
Gajanan Raje
The RRButton is a custom control written by Borje Hagsten. You normally need to use the messages specifically designed for that control rather than the built in FireFly Functions which work on standard Windows controls.
The messages for the RRButton are defined in the file RRBUTTON.INC and is found in the \CustomControls\Borje Hagsten\RRButton subdirectory off of your main FireFly install directory.
Here is the code that you need:
Function FORM1_RRBUTTON1_BN_CLICKED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idButtonControl As Long _ ' identifier of button
) As Long
FF_Control_SetText HWND_FORM1_RRBUTTON1, "Connected"
SendMessage HWND_FORM1_RRBUTTON1, %RBM_SETBTNCOLOR, %Green, %TRUE
End Function
Thanks. I appreciate your quick response.
Gajanan Raje