The problem is that I need to colour the 'static' field at the top of an un-editable ComboBox control. I've tried intercepting #WM_CTLCOLORSTATIC events, but no joy.
The following code shows my progress so far in that I can colour the listbox easily enough:
Code: Select all
global OldCombProc.l, BackBrush.l
BackBrush = CreateSolidBrush_(#blue)
Procedure.l ComboCallBack( hWnd.l, uMsg.l, wParam.l, lParam.l )
protected result
if uMsg = #WM_CTLCOLORLISTBOX
SetBkMode_(wParam,#TRANSPARENT)
SetTextColor_(wParam,#red)
SetBkColor_(wParam,#blue)
result = BackBrush
Else
result = CallWindowProc_(OldCombProc, hWnd, uMsg, wParam, lParam)
EndIf
procedurereturn result
endprocedure
If OpenWindow(0,0,0,270,440,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"ComboBoxGadget") And CreateGadgetList(WindowID(0))
ComboBoxGadget(1,10,40,250,50)
For a=0 To 15 : AddGadgetItem(1,-1,"ComboBox item "+Str(a)) : Next
SetGadgetState(1,0)
OldCombProc=SetWindowLong_(GadgetID(1), #GWL_WNDPROC, @ComboCallBack())
Repeat
EventID = WaitWindowEvent()
Select EventID
Case #PB_Event_Gadget
select EventGadgetID()
EndSelect
EndSelect
Until EventID = #PB_Event_CloseWindow
EndIf
Anyone have a solution?
Thanks.