Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[FUNCTION] SetEditCueBanner [AHK_L]


  • Please log in to reply
13 replies to this topic
just me
  • Members
  • 1496 posts
  • Last active: Nov 03 2015 04:32 PM
  • Joined: 28 May 2011

EM_SETCUEBANNER

Sets the textual cue, or tip, that is displayed by the edit control to prompt the user for information.
[*:2u85gcfu]You cannot set a cue banner on a multiline edit control or on a rich edit control.
[*:2u85gcfu]The cue banners don't work when the Asian language pack is installed on XP (the "Install files for East Asian languages" option). See <!-- m -->http://blogs.msdn.co... ... 38735.aspx<!-- m --> . This issue is fixed on Vista.
[*:2u85gcfu]wParam TRUE - only appears to work on Vista. Under XP the cue text always disappears when the control gets focus regardless of this parameter.

Gui, Margin, 20, 20
Gui, Font, s10 Bold
Gui, Add, Text, , Name
Gui, Font, Normal
Gui, Add, Edit, xm y+10 w150 hwndHED1
SetEditCueBanner(HED1, "First")
Gui, Add, Edit, x+10 yp wp hwndHED2
SetEditCueBanner(HED2, "Last")
Gui, Show, , EM_SETCUEBANNER
Return
GuiClose:
ExitApp 

SetEditCueBanner(HWND, Cue) {  ; requires AHL_L
   Static EM_SETCUEBANNER := (0x1500 + 1)
   Return DllCall("User32.dll\SendMessageW", "Ptr", HWND, "Uint", EM_SETCUEBANNER, "Ptr", True, "WStr", Cue)
}
If the function cannot be used because of the above mentioned limitations you may try Placeholder()

sumon
  • Moderators
  • 1317 posts
  • Last active: Dec 05 2016 10:14 PM
  • Joined: 18 May 2010
Very nice!

Posted Image

In HTML5, this is known as a "placeholder", and it's actually extremely useful in my opinion. Shouldn't be overused, of course, but it's a very good design habit to make cues as clear as possible.

Cragaha
  • Members
  • 265 posts
  • Last active: Jan 04 2016 02:24 AM
  • Joined: 19 Nov 2010
Very nice Posted Image

hughman
  • Members
  • 192 posts
  • Last active: Feb 14 2016 06:59 AM
  • Joined: 11 Feb 2007
The cue banners don't work when the Asian language pack is installed on XP

Learning one
  • Members
  • 1483 posts
  • Last active: Jan 02 2016 02:30 PM
  • Joined: 04 Apr 2009
Nice. Useful. Short. Simple.
I like it! :D Thanks.

sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
A caveat emptor from a guest in the [fn][L] Placeholder() thread:

...EM_SETCUEBANNER does not work on multi-line edit controls...



just me
  • Members
  • 1496 posts
  • Last active: Nov 03 2015 04:32 PM
  • Joined: 28 May 2011
All caveat emptors are stated on the EM_SETCUEBANNER page (see OP). :wink:

sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008
A new user may not find that link to be obvious, so it's probably a better idea to state it up front.

just me
  • Members
  • 1496 posts
  • Last active: Nov 03 2015 04:32 PM
  • Joined: 28 May 2011
Done.

gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009
Nice work,

For _Basic, see:
<!-- m -->http://www.autohotke... ... 975#368975<!-- m -->

hoppfrosch
  • Members
  • 399 posts
  • Last active: Feb 26 2016 05:31 AM
  • Joined: 25 Jan 2006
Nice one - everything seems so simple, when you know how to do it ...

Foodfast04
  • Members
  • 2 posts
  • Last active: Feb 23 2012 04:29 PM
  • Joined: 07 Feb 2012
is the cue banner work when I'm using Windows 7 and installed Asian Language Pack in system.

just me
  • Members
  • 1496 posts
  • Last active: Nov 03 2015 04:32 PM
  • Joined: 28 May 2011

This issue is fixed on Vista.

...and hopefully on Win 7? I don't know.

Wicked
  • Members
  • 504 posts
  • Last active: Nov 18 2018 02:17 AM
  • Joined: 07 Jun 2008
Thank you for showing this! ! !

3nL8f.png