How to create disappearing/reappearing Edit Box User Prompts

Helpful script writing tricks and HowTo's
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

How to create disappearing/reappearing Edit Box User Prompts

23 Nov 2017, 18:35

This tutorial covers how to create gui edit box user prompts that disappear or reappear based on interactions.

User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: How to create disappearing/reappearing Edit Box User Prompts

24 Nov 2017, 06:04

See EM_SETCUEBANNER here: https://autohotkey.com/board/topic/5574 ... nner-work/
Since there are shortcomings in the M$ implementations I've built a proof-of-concept function CueBanner:
https://autohotkey.com/boards/viewtopic.php?f=6&t=34422

There's also a CB_SETCUEBANNER message for comboboxes. My function covers many other control types.
Part of my AHK work can be found here.
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: How to create disappearing/reappearing Edit Box User Prompts

24 Nov 2017, 07:45

Cool, so there is a name for this.

The first one has something wrong with it, it only displays 1 character, and you can't change the font options.
Never tried the second one cause I don't download, but it looks neat.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: How to create disappearing/reappearing Edit Box User Prompts

24 Nov 2017, 08:04

The "official" EM_SETCUEBANNER requires a widechar string, maybe you used an ANSI AHK version or the wrong version of the script; further down that page there are some fixed versions that should work correctly with AHK 1.0 but may need corrections for a Unicode AHK. Usually displaying only first character in a string is a sign that an ANSI string has been used in a function that requires a widechar string.
Indeed, the official message has fixed font and color for the cue banner, derived from the current theme/visual style.
My function has many improvements and works from a (slightly updated) Win98SE up to Win10, it's compatible with both AHK 1.0 and 1.1.
I tried to upload all the code versions to the board but hit a limitation so I placed them in my online repository. Since there are more scripts related to each-other I decided to compress them in a single file, easier to handle. It's safe to use but it's your right not to download it. ;)
Thanks for your appreciation. :)
Part of my AHK work can be found here.
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: How to create disappearing/reappearing Edit Box User Prompts

24 Nov 2017, 08:48

Just so you know, I'm not trying to imply that there is something wrong with the download, it's just that my anti-virus license recently expired and unnecessary risks are unnecessary. The tutorials I do are geared for newcomers so I try to keep things as simple and easy to follow as I can. I also normally try to include a wide range of items in the tutorials, which is why I take the time to explain everything that I am doing. The goal is to expose the viewer to a number of items and to try to show that there is normally more than one way to skin a cat.

That said, these tutorials are a first round of them, and my personal plan is to take what I learn from doing these tutorials and apply the skills that I gain from them to next generation tutorials. The simple fact of the matter is that I am not an expert in ahk, I don't try to pretend that I know all, I likely would have never done any tutorials to begin with if there were more when I started. I find it much easier to learn this stuff when I can hear someone explaining it, see it unfold line by line. Too often when I look at the documentation etc I will come across terminology that without first going a following that rabbit down the hole to see what it is talking about/means I am left with gaps, big gaps and am forced to interpret/guess what it means. In the end, when I saw that the amount of video tutorials were lacking I could have just passed on by, but I decided to try to change that, make it so that other like me will have access to a library of videos covering AHK a-z. I still have to struggle with learning this without videos, but hopefully my efforts make it so that those that follow don't.

If you are ever able to post your code as text and would like it included in my next pass at this topic, I would be happy to do so.
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: How to create disappearing/reappearing Edit Box User Prompts

24 Nov 2017, 09:32

That would be a bit complicated because there are eight AHK scripts and a TXT file in that 7-zip archive. BTW, there is no executable or anything else in there, it's pure AHK code and the changelog so in my opinion there is no risk in dowloading unless you don't trust your browser or the board. I made a habit out of offering separate downloads for pure code and compiled executables precisely so that cautious people could still access the code without any risk. Personally I don't trust any antivirus out there, for various reasons, but that's only me. :)

Now please forgive me for this (hopefully constructive) criticism but the very reason I intervened is the overly complicated manoeuvers you made for simply displaying a couple of cue banners. I understood you didn't know about them and thought it might be better to first offer the simplest help possible by using the original messages (EM_SETCUEBANNER and further on CB_SETCUEBANNER) in a straightforward implementation, then expand and improve by replacing them with your own version (which is what you did in the current tutorial) and maybe at some point also refer users to my function for a more complex and diverse appearance. A gradual learning curve.

Your intentions are honorable and you deserve help and appreciation. We all learned from someone, sometime, and we keep learning as long as we live. ;)
Part of my AHK work can be found here.
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

Re: How to create disappearing/reappearing Edit Box User Prompts

24 Nov 2017, 10:55

Hellbent, I have enjoyed your tutorials in the past, thanks for sharing them. I think they're a great reference source. I like the embedded video, cool.
Drugwash, thanks again for CueBanner - I see it's now up 2.6.7 at the CueBanner repository. Mulțumesc frumos.
Regards,
burque505
User avatar
Drugwash
Posts: 850
Joined: 29 May 2014, 21:07
Location: Ploieşti, Romania
Contact:

Re: How to create disappearing/reappearing Edit Box User Prompts

24 Nov 2017, 13:10

You're welcome, burque. :) I kinda lost track of my scripts (and AHK as a whole) since the 98SE machine is off. Hopefully everything's alright with the script and it does its job. ;)
Part of my AHK work can be found here.

Return to “Tutorials (v1)”

Who is online

Users browsing this forum: No registered users and 25 guests