[v2 GUI] Cue banner for edit controls (placeholder)

Propose new features and changes
User avatar
jNizM
Posts: 2613
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

[v2 GUI] Cue banner for edit controls (placeholder)

18 Dec 2019, 04:53

Are there plans to integrate EM_SETCUEBANNER and CB_SETCUEBANNER into the Gui objects as Build-In?

Info:
EM_SETCUEBANNER message -> Sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information.
CB_SETCUEBANNER message -> Sets the cue banner text that is displayed for the edit control of a combo box.


Example (it might look like this) in v2:

Code: Select all

MyEdit := Gui.Add("Edit", "x10 y10 w250")
MyEdit.SetCue("Enter Text here...")
; Gui.Add("Edit", "x10 y10 w250").SetCue("Enter Text here...")     ; alternate

MyCombo := Gui.Add("ComboBox", "x10 y10 w250")
MyCombo.SetCue("Enter Text here...")
; Gui.Add("ComboBox", "x10 y10 w250").SetCue("Enter Text here...")     ; alternate


How I use it atm in v1.1 as functions:

Code: Select all

; ===============================================================================================================================
; Message ..................:  EM_SETCUEBANNER
; Minimum supported client .:  Windows Vista
; Minimum supported server .:  Windows Server 2003
; Links ....................:  https://docs.microsoft.com/en-us/windows/win32/controls/em-setcuebanner
; Description ..............:  Sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information.
; Option ...................:  True  -> if the cue banner should show even when the edit control has focus
;                              False -> if the cue banner disappears when the user clicks in the control
; ===============================================================================================================================

EM_SETCUEBANNER(handle, string, option := true)
{
	static ECM_FIRST       := 0x1500 
	static EM_SETCUEBANNER := ECM_FIRST + 1
	if (DllCall("user32\SendMessage", "ptr", handle, "uint", EM_SETCUEBANNER, "int", option, "str", string, "int"))
		return true
	return false
}

; ===============================================================================================================================

Code: Select all

; ===============================================================================================================================
; Message ..................:  CB_SETCUEBANNER
; Minimum supported client .:  Windows Vista
; Minimum supported server .:  Windows Server 2008
; Links ....................:  https://docs.microsoft.com/en-us/windows/win32/controls/cb-setcuebanner
; Description ..............:  Sets the cue banner text that is displayed for the edit control of a combo box.
; ===============================================================================================================================

CB_SETCUEBANNER(handle, string)
{
	static CBM_FIRST       := 0x1700
	static CB_SETCUEBANNER := CBM_FIRST + 3
	if (DllCall("user32\SendMessage", "ptr", handle, "uint", CB_SETCUEBANNER, "int", 0, "str", string, "int"))
		return true
	return false
}

; ===============================================================================================================================
[AHK] 1.1.32.00 x64 Unicode | [WIN] 10 Pro (Version 2004) x64 | [GitHub] Profile
Donations are appreciated if I could help you
DRocks
Posts: 559
Joined: 08 May 2018, 10:20

Re: [GUI] Cue banner for edit controls (placeholder)

14 Jan 2020, 08:19

That's an interesting and useful idea in my opinion.
Would be a nice practical thing to see listed in the autocomplete of a "IDE" and the AHK docs too.

For example, ideally, the IDE would know that myEdit. has setCue(), setFont(), setValue(), setSize(), etc.
And the AHK docs would have a explanation of this listed in the GuiControl's page so when we read the docs, we get a inspiration just by seeing the possibility of that option.
lexikos
Posts: 6854
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: [GUI] Cue banner for edit controls (placeholder)

28 Jun 2020, 02:04

I moved this to Wish List, since I see no particular reason to prioritize it prior to the v2.0 release.

I think a property would be more appropriate than a method. I would suggest CueText.

As for the initial question, no, I have no plan to implement it. I would have to spend time developing, testing and documenting it, and then subsequently (most likely) never use it myself. It probably hadn't even crossed my mind before I saw this topic. If someone else wants to do all of the work and submit it via GitHub, I may merge it.

I would like to point out that a script can add methods and properties to all GUI controls of a specific type via the corresponding prototype (base) object. A user-defined library could thus be integrated fairly well with the Gui API. Currently it is necessary to create a control of that type and retrieve .base, but in future the control's class should be accessible directly.

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 21 guests