[CLASS] CtlColors - color your controls (2017-10-30)

Post your working scripts, libraries and tools
just me
Posts: 6430
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] CtlColors - color your controls (2017-10-30)

24 Dec 2018, 03:23

Hatsuko wrote:
23 Dec 2018, 07:08

unfortunately I have no idea why colouring stops working. Apparently the hotkeys are triggered, logs are written and CtlColors.Change() is called. The garbled tooltips are an additional mystery.

You might try to call the UpdateWindow() function directly after each call of InvalidateRect().

Code: Select all

      DllCall("User32.dll\InvalidateRect", "Ptr", HWND, "Ptr", 0, "Int", 1)
      DllCall("User32.dll\UpdateWindow", "Ptr", HWND) ; <--- added
The function sends a WM_PAINT message directly to the window procedure of the specified window, bypassing the application queue.
Posts: 153
Joined: 08 Oct 2018, 12:57

Re: [CLASS] CtlColors - color your controls (2017-10-30)

24 Dec 2018, 13:10

Portwolf wrote:
10 Dec 2018, 12:03
And i failed miserably..
I cannot understand how to do it..(...)
How do i set that up? i already added the hwndHTX but, cannot get it working.
I'm seeing a lot of code there that i almost dont understand..
Like many here, im pretty new to this.
Ok, i failed miserably because i was a dumbass....
Code was correct, but i was coloring it on the wrong order.
As the code went along, it was coloring the wrong elements.

Thank for the help boys :D
It was a question of error 16: dumbass user.

:trollface: :trollface:
Posts: 106
Joined: 20 Mar 2014, 20:24

Re: [CLASS] CtlColors - color your controls (2017-10-30)

19 Jul 2019, 13:27

I am trying to change the background color of some edit controls. This works great if the control's parent is the window, but it doesn't seem to work if their parent is another control on the window. FWIW, I can't get CColor to work either. I can create the edit controls as children of the window, color them, then change their parent to the other control; however, after changing their parent, I can no longer change the color. Any ideas how I might work around this issue?

just me
Posts: 6430
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [CLASS] CtlColors - color your controls (2017-10-30)

20 Jul 2019, 02:53

The class relies on WM_CTLCOLOR... notifications which are always send to the control's parent window. The message handler registered for the class does not receive the notifications. If you nevertheless want to use the class, subclassing the parent and calling CtlColors_OnMessage() directly for incoming WM_CTLCOLOR... messages or forwarding the message to the original parent might work.

Regards, just me

Return to “Scripts and Functions”

Who is online

Users browsing this forum: TAC109 and 50 guests