Hi,
With FireFly I can set the ForeGround and Background colors for a specified Control with FF_Control_SetColor buit-in function.
I need a FF_Control_GetColor function to retrieve Foreground and BackGround colors of a TEXTBOX.
Do you know how I can do that in FireFly ?
Thank you.
Jean-Pierre.
It is not as easy as you would think. There is currently no built in FireFly function that does this.
It can be done. You need to retrieve the FF_PTR prop from the TextBox that you are interested in. The FF_PTR prop value is a pointer to a FF_DATA structure that is attached to every Form and Control created in FireFly.
Once you have the pointer to the FF_DATA structure, you simply need to retrieve the values from the TYPE that interest you. In this case, I assume that you want the RGB color value ????
Maybe something like the following (untested - I am writting this on-line):
Function FF_Control_GetColor (ByVal hWndControl As DWord, _
ByRef ForeColor As Dword, _
ByRef BackColor As Dword _
) as DWord
Local ff_control As FF_DATA Ptr
if iswindow(hWndControl) = 0 then exit function
ff_control = GetProp(hWndControl, "FF_PTR")
If ff_control = 0 Then Exit Function
'the color will depend on whether this is a system color...
If @ff_control.IsForeSysColor Then
ForeColor = GetSysColor(@ff_control.ForeColorNumber)
Else
ForeColor = @ff_control.ForeColorNumber
End IF
If @ff_control.IsBackSysColor Then
BackColor = GetSysColor(@ff_control.BackColorNumber)
Else
BackColor = @ff_control.BackColorNumber
End IF
End Function
Hi Paul,
Thank you for the FF_Control_GetColor function.
FF_Control_GetColor works well to retrieve the initial "BackColor" and "ForeColor" that I have set in the properties of the control in the FireFly User Interface.
But if I change "BackColor" and / or "ForeColor" using the FF_Control_SetColor function, the FF_Control_GetColor doesn't retrieve the new colors; FF_Control_GetColor always retrieve the initial color that I have set in the properties of the control in the FireFly User Interface.
Is it normal ?
Hmm...I wondered about that when I was playing around with those functions too. That is probably something that needs fixed since the prop is used to set the colors on SystemColor Changes...
Hi Paul,
Do you think the FF_Control_GetColor function will work in the next update of FF; I think this problem is related to this topic that you fixed :
http://www.planetsquires.com/forums/viewtopic.php?t=1647
Is it possible to add the FF_Control_GetColor to the FireFly function ?
Thank you.
Jean-Pierre.
The FF_Control_GetColor function has now been added....
:)
Paul,
Thank you very much for your kind support, FireFly is becoming better and better !
Jean-Pierre