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

Post your working scripts, libraries and tools
just me
Posts: 6567
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
Hi,

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.
Portwolf
Posts: 161
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:
Sam_
Posts: 108
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?

TIA,
Sam.
just me
Posts: 6567
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
User avatar
lmstearn
Posts: 248
Joined: 11 Aug 2016, 02:32
GitHub: lmstearn
Contact:

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

12 Sep 2019, 10:41

CtlColors is more portable than majkinetor's CColor, although that was documented to also support ListView, TreeView and RichEdit.
Originally tried for a listbox, SKAN's modified version of RegisterCallback from the docs, In that case, if there was more than one control in the script, a new RegisterCallback had to be coded per listbox, or else the script failed when attempting to apply the original callback on another control.
This is so much better, thanks. :)
:arrow: itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH

Return to “Scripts and Functions”

Who is online

Users browsing this forum: arcticir and 55 guests