Hi,
Does someone know how I can change the Background of an disabled Stringgadget with EasyVENT?
The Message for that is #WM_CTLCOLORSTATIC but it just doesn'T arrive in the CallBackFunction when using, #OnUnhandledWinMessage.
Can someone help me please?
#WM_CTLCOLORSTATIC with EasyVENT
#WM_CTLCOLORSTATIC with EasyVENT
Apart from that Mrs Lincoln, how was the show?
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Re: #WM_CTLCOLORSTATIC with EasyVENT
For a StringGadget it's #WM_CTLCOLOREDIT.Konne wrote:Hi,
Does someone know how I can change the Background of an disabled Stringgadget with EasyVENT?
The Message for that is #WM_CTLCOLORSTATIC but it just doesn'T arrive in the CallBackFunction when using, #OnUnhandledWinMessage.
Can someone help me please?
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
You are right, sorry.
I never noticed that because I handle all the #WM_CTLCOLOR* messages with the same code.
No problem to get the #WM_CTLCOLORSTATIC message for a disabled StringGadget in PureCOLOR, but I use subclassing. I don't know about EasyVENT.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
@Konne, your problem is that #WM_CTLCOLORSTATIC is sent to the parent window and so you must handle the main window #OnUnhandledWinMessage event.
The following demonstrates how to use EasyVENT's #OnUnhandledWinMessage message to colour a static control.
I hope it helps.
*EDIT: why not simply use SetGadgetColor() ?
The following demonstrates how to use EasyVENT's #OnUnhandledWinMessage message to colour a static control.
Code: Select all
;EasyVENT demonstration program - general.
;*********************************************************************************
;DEMONSTRATES #OnUnhandledWinMessage, by colouring a static control.
;*********************************************************************************
;ESSENTIAL INCLUDE.
;*********************************************************************************
XIncludeFile "EasyVENT.pbi"
;*********************************************************************************
Global GadgetBackground, GadgetForeground
GadgetBackground = CreateSolidBrush_(#Blue)
GadgetForeground = #Red
Declare.l StaticProc(*sender.PB_Sender)
Define Event.l
OpenWindow(0, 100, 100, 600, 600, "Colour static control.", #PB_Window_SystemMenu |#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget| #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
TextGadget(1, 5, 15, 120, 20, "Text gadget")
;Set event handlers.
;We are interested in #WM_CTLCOLORSTATIC, which is sent to the parent window. Hence we
;set a handler for the main window.
SetEventHandler(WindowID(0), #OnUnhandledWinMessage, @StaticProc())
;Force a recolouring of the text gadget.
InvalidateRect_(GadgetID(1),0,1)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End
;*********************************************************************************
; EVENT HANDLERS
;*********************************************************************************
Procedure.l staticProc(*sender.PB_Sender)
Protected result=#PB_ProcessPureBasicEvents
If *sender\uMsg=#WM_CTLCOLORSTATIC And *sender\lParam=GadgetID(1)
SetBkMode_(*sender\wParam,#TRANSPARENT)
SetTextColor_(*sender\wParam,GadgetForeground)
result = GadgetBackground
EndIf
ProcedureReturn result
EndProcedure
*EDIT: why not simply use SetGadgetColor() ?
I may look like a mule, but I'm not a complete ass.
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
PureCOLOR_SetGadgetColor() worksKonne wrote:First Thx.
Because SetGadgetcolor doesn't work for disabled Gadgets.

For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).