Hello!
I know that there is the FF_Control_SetColor function to change control's colors, and you can easily change the Combo's background color from within FireFly, but try this:
FF_CONTROL_SETCOLOR(HWND_FORM1_COMBO1, -1, GETSYSCOLOR(%COLOR_BTNFACE))
To make a ComboBox look truly "disabled". The result leaves a little to be desired and I have not found a workaround yet. Using InvalidateRect and UpdateWindow or FF_Control_Redraw does not work!
Can anyone help?
Thanks
Philipp
The 'problem' is that certain styles of the combobox involve an edit box and a list box. In order to change the background color of the edit box portion we need to handle the brush coloring ourselves.
The following code is placed in the Custom message handler for the combobox. It handles the various %WM_CTLCLRXXX messages that are sent from the child edit box (the combobox is the parent). If the control is disabled, then we return a brush that will color the background gray.
Hope this works for you.
Function FORM1_COMBO1_CUSTOM ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
wMsg As Long, _ ' type of message
wParam As Dword, _ ' first message parameter
lParam As Long _ ' second message parameter
) As Long
Select Case wMsg
Case %WM_CTLCOLORLISTBOX, %WM_CTLCOLOREDIT, %WM_CTLCOLORSTATIC, %WM_CTLCOLORBTN
If IsWindowEnabled( hWndControl ) = 0 Then
SetBkMode wParam, %OPAQUE
Function = GetSysColorBrush(%COLOR_BTNFACE)
Exit Function
End If
End Select
End Function
Thank you very much for the quick reply! That worked for me.
It is interesting that VB, Delphi and VC++ do not require this kind of custom message handling. They probably have this code incorporated automatically.
Hmmm,
if that is so than FireFly could do the same, but I think there is something more at hand here... I think..
Marc