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

Post your working scripts, libraries and tools for AHK v1.1 and older
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

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

23 Jul 2021, 05:33

jNizM wrote:
22 Jul 2021, 08:38
Is this a bug or does I missed something in my code? Even with ReDraw the control lose the color after RightClick the ListView to open a Menu.
It is just the focused Edit Control who lose the color.
...
Hi, you might want to try

Code: Select all

GuiContextMenu:
	if !(InStr(A_GuiControl, "LV01"))
		return
	Sleep, -1 ; process the message queue
	Menu, EditMenu, Show, % A_GuiX, % A_GuiY
	Gui, %A_Gui%:+LastFound
	WinSet, ReDraw
return
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

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

23 Jul 2021, 06:59

Works. Sleep, -1 infront of the menu was the magic trick. Thanky you.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

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

24 Jul 2021, 06:36

jNizM wrote:
21 Jul 2021, 08:42
Is it possible to color DateTime Controls (just the Edit Control in DateTime) too?
As a result of my testing it seems that a 'real' edit control will be created and destroyed 'on demand' (like already said in the linked articles). Because each edit has its own unique HWND, it's not possible to register the control. Moreover, the controls don't seem to send WM_CTLCOLOREDIT messages to the AHK Gui.
fabricio234
Posts: 122
Joined: 06 Mar 2020, 21:48

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

21 Nov 2021, 15:41

@just me did you figured out why sometimes things using ctlcolors get entire white for a sec then restored?
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

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

22 Nov 2021, 05:07

@fabricio234: I didn't have that issue as yet.
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

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

18 Oct 2022, 15:51

I'm using this control to set the background and foreground color of an Edit control.

CtlColors.Change(g_strEditorControlHwnd, strEditBackgroundColor, strEditTextColor)

It works well except when the content of the control is completely deleted (Ctrl+A, Del). Just after the content deletion, the background turns white until the window is refreshed in some way, for example by switching to another app and switching back to my app (Alt+Tab and Alt+Tab again). Is this a known issue?
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
Spitzi
Posts: 313
Joined: 24 Feb 2022, 03:45

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

14 Mar 2024, 03:31

Hi @just me.

Did you ever update the code to AHK2?

Greets Spitzi
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

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

14 Mar 2024, 03:45

Hi @Spitzi, no. In v2 you can use the options
C: Color of text (has no effect on buttons and status bars).
and/or
BackgroundColor: Changes the background color of the control.
options for many controls.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 147 guests