Jump to content


Photo

[FUNCTION] Custom multi style Message Box


  • Please log in to reply
No replies to this topic

#1 r0k

r0k
  • Members
  • 35 posts

Posted 21 April 2012 - 01:24 PM

As i was working on a script, i realized i needed a more flexible message box than the built-in one. I searched the forum, found an existing function, realized i still wanted something more flexible, and started working on my own. It's now working properly (at least in all my tests) so i decided to share it.
I know there are already a couple of those but i tried to make this one as customizable as possible so other people might find it useful.

Features

[*:1ocgra09]Easy to use. Put in your library and use as any built-in functions. Only two parameters are required by default.
[*:1ocgra09]You can add any number of buttons, making any button the default one is as easy as putting * in front if it's name.
[*:1ocgra09]Non Closing Buttons : Define one or more non closing buttons by adding + in front of their name. When the use clicks those, the message bow won't automatically close so you can display a help box or something similar and still wait for their input.
[*:1ocgra09]Use one of 7 system message icon and associated system sound.
[*:1ocgra09]Choose between vertical and horizontal buttons.
[*:1ocgra09]Change font, font size and text area for tiny or huge message boxes.
[*:1ocgra09]Use any optional GUI style like +Toolwindow or -Sysmenu
Requirements
AutoHotKey_L is required.

Some screenshots.
Posted Image Posted Image
Posted Image Posted Image
Posted Image

Download AHK file

Example boxes (from the screenshots)
; this is a test script for the custom multi style message box.

fn_CMsgBox("Basic","This is the most basic box with only title and text")

fn_CMsgBox("Vertical","This one has vertical buttons.`nDo you like it?","*Yes|No","Align_V", "Icon_Question2")

fn_CMsgBox("Warning","Big Enough?","*Yes|No","Icon_Warn","Fontsize_14","Textarea_w200 r2")

fn_CMsgBox("Different Style","Style_+ToolWindow",,"Style_+ToolWindow")

fn_CMsgBox("Lots of text",
		  ( LTrim
		    "You can enlarge the text are if you need to put lots of text.
			This box can really contain lots of text.
			And by lots, i mean LOTS.
			Really, you can make it as big as you want, or at least, as big as the screen.
			Do i really need to fill all this text?
			I specified r12, this means you can put 12 rows of text.
			This is row 7
			This is row 8
			This is row 9
			I'm getting bored!
			I really should have choosen less rows to fill.
			Phew, row 12!"
		  ),,"Textarea_w450 r12")

ExitApp