Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Extended Message Box - New Version: 11 Aug 13


  • Please log in to reply
154 replies to this topic

#1 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,119 posts

Posted 29 January 2010 - 04:51 PM

*
POPULAR

Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox?

Would you like to have coloured backgrounds and text? To choose the justification and font?

Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen?

What about having user-defined text on as many buttons as you need? And user-defined icons? Or a visible countdown of the timeout?

Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar?

If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you!


 
[NEW VERSION] 11 Aug 13

Added:

- 1. Buttons will now expand to fit the text within them as long as they will still fit within the EMB. Note that all buttons will be set to the same width, so a single long text will expand all buttons.

- 2. The user can now determine the max and absolute size of the EMB. The max size determines how far the EMB will expand to accommodate lines of text without wrapping - it also determines the max size for the buttons (see above). The absolute size is there to cater for very long unbroken strings (such as a path) which might be wider than the set max width - the EMB will expand incrementally to this value in an attempt to fit the string.


Thanks to jdicerch and BreManNH who asked for the changes. thumbsup.gif

New UDF and Example 3 below and in the zip. smile.png

Older versions: Attached File  ChangeLog.txt   3.96KB   306 downloads

[NEW] Here is the ExtMsgBox UDF itself:
Spoiler

There are 2 user functions within the UDF:

1. _ExtMsgBox_Set: Sets the GUI style, justification, colours, font and max width for subsequent _ExtMsgBox function calls
2. _ExtMsgBox: Generates the ExtMsgBox itself centred on a GUI, on screen or at defined coordinates

You will also need an include file (another of my UDFs) to make sure the ExtMsgBox is large enough to fit the required content. You an download it from here - just save it as StringSize.au3 in the same folder:

[NEW] An example script to show it all working:
Spoiler

And a second example showing the tab expansion ability:
Spoiler

[NEW] An example to show the button expansion:
Spoiler

As always, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with my UDFs (which you can find in my sig) I am trying to prevent the need for any other include files.

All files above (plus StringSize)in zip format: Attached File  ExtMsgBox.zip   15.11KB   1910 downloads

Courteous comments and constructive criticisms welcome - guess which I prefer! smile.png

M23

Edited by Melba23, 08 September 2014 - 05:52 PM.

  • mesale0077, Neutro, header127 and 3 others like this
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items







#2 dmob

dmob

    Polymath

  • Active Members
  • PipPipPipPip
  • 238 posts

Posted 29 January 2010 - 05:29 PM

Wow!!! Outstanding stuff. Marvellous work, Melba...
You, Sir, are top notch:graduated:
  • MariusN likes this

#3 reb

reb

    Prodigy

  • Active Members
  • PipPipPip
  • 155 posts

Posted 30 January 2010 - 12:44 AM

GREAT JOB!
I love your work.

while playing with your example I found that line 140 should read ConsoleWrite("Test 6 returned: " & $iRetValue & @CRLF)
not ConsoleWrite("Test 5 returned: " & $iRetValue & @CRLF)
Guess the old copy/paste bug got you. :D

It is nice to download an example and have it go right off the bat. Keep them coming.

REB
MEASURE TWICE - CUT ONCE

#4 rogdog

rogdog

    Wayfarer

  • Active Members
  • Pip
  • 59 posts

Posted 08 February 2010 - 08:14 PM

Thanks, great work :-)

#5 Fire

Fire

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 366 posts

Posted 09 February 2010 - 09:36 PM

Great Job Melba23 It works Cool.
Thank you very-very much.

#6 Mat

Mat

    43 38 48 31 30 4E 34 4F 32

  • MVPs
  • 5,071 posts

Posted 09 February 2010 - 10:45 PM

Great Job Melba23 It works Cool.
Thank you very-very much.

btw, the forum has an inbuilt way to post members: Melba23

#7 Fire

Fire

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 366 posts

Posted 10 February 2010 - 08:59 PM

Hi to all again.
Just wondering about:
If i use standart msgbox of Autoit with flag 64 and when it appears i hear "ding" sound.
But when i use _ExtMsgBox() and when it appears i didn`t hear somethink like that sound which i say at bottom(i assume "ding" sound)
So my question: Is here any other ways to do it somethink like which i mean?
I use this way to figure it out:
_ExtMsgBox (64 , "Beli|Xeyr|LEGV", "title", $sTestMsg,5)

No success:( Only icon changed in MSGBOX and it still silent:(
Any hints would be super as always.
Thanks in advance.

Edited by Sh3llC043r, 10 February 2010 - 09:03 PM.


#8 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,119 posts

Posted 10 February 2010 - 10:21 PM

Sh3llC043r,

If you want a sound as the ExtMsgBox appears, just add this line into the UDF after the GUI is shown:
; Show GUI GUISetState(@SW_SHOW, $hMsgGUI) ; Play sound Soundplay(@WindowsDir & "\Media\Windows Exclamation.wav", 1)

From what I can see from my system, the sound should normally only be heard for alert, rather than information or query, message boxes. If you want to match that then you need to use this line:
If $iIcon_Style = -2 Or $iIcon_Style = -4 Then Soundplay(@WindowsDir & "\Media\Windows Exclamation.wav", 1)

Happy listening! :D

M23
  • iFFgen likes this
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#9 Fire

Fire

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 366 posts

Posted 10 February 2010 - 10:50 PM

Yes

Melba23 you solve it.Thank you very much.
Only one problem in this method is if user OS == from my (which i wrote in eg. my script) it may cause problems.
BTW i can use Fileinstall() for Windows Exclamation.wav(renamed in ex:sound64.wav) and use it.
You solve my problem THANK YOU VERY-VERY MUCH. You are amazing:huggles:

#10 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,666 posts

Posted 21 July 2010 - 02:58 PM

Are you annoyed by the limitations of the standard Windows message dialog created by MsgBox?

Would you like to have coloured backgrounds and text? To choose the justification and font?

Do you want to be able to place the message box other than in the centre of the screen? Centred on your GUI, for example, or at a particular location on screen?

What about having user-defined text on up to 6 buttons? And user-defined icons?

Finally, would you like to choose whether the message box has a button on your already too-crowded taskbar?

If the answer to any of these questions is "YES" then the ExtMsgBox UDF is for you!
:blink:
<snip code out>

Once again, I realise nearly all of the DLL calls in these UDFs could be made by using commands in other UDFs like WinAPI.au3 - but as with my Toast UDF (which you can find here) I am trying to prevent the need for any other include files to prevent bloat. If anyone wants the "pretty" versions, just let me know!

As always, courteous comments and constructive criticisms welcome - guess which I prefer! :P

All files above in zip format:

M23

Edit: Minor code change to example script - see 2 posts below. ;)

You might want to update the files that you uploaded in the .zip file. I ran this example script with the 2 #include files contained in the archive and I was getting errors all over the place. When I copied the text from the post rather than downloading it, it worked great. Also, this script requires another function you posted called GetDefaultFont.au3 which isn't shown or included here. I found it by searching for the function name on the forums here and I found it here.

Edited by BrewManNH, 21 July 2010 - 03:06 PM.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#11 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,119 posts

Posted 21 July 2010 - 03:06 PM

BrewManNH,

Apologies for that - not quite sure what happened there, the zip had an older version of the UDF in it. :blink: New zip files uploaded.

I hope you liked the UDF after all that! ;)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#12 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,666 posts

Posted 21 July 2010 - 03:10 PM

BrewManNH,

Apologies for that - not quite sure what happened there, the zip had an older version of the UDF in it. :blink: New zip files uploaded.

I hope you liked the UDF after all that! :P

M23

No worries, once I figured out what had happened, it all came together and worked great, I will definitely be including this in place of the standard message box when I need to make an impact. Thank you for your work on this. I hope to be able to be able to figure out this language one day. ;)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#13 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,119 posts

Posted 21 July 2010 - 03:25 PM

BrewManNH,

Glad you like it. :blink:

By the way, when you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. ;)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#14 meisandy

meisandy

    Prodigy

  • Active Members
  • PipPipPip
  • 153 posts

Posted 24 July 2010 - 10:54 AM

Thanks Melba - As always, Great work - as always

I hate to say this, but isn't it just a GUI not a Msgbox, what was the point of going to all that trouble when you can use predifined GUI's?

But nevertheless, I'm not slaging you off, because I probably will use it some time!

#15 KaFu

KaFu

    Hey, it's just me, KhaFoo...

  • MVPs
  • 3,409 posts

Posted 24 July 2010 - 11:28 AM

...but isn't it just a GUI not a Msgbox...

Not quite, a GUI is a window. A MsgBox is a predifined GUI with some few options whereas _ExtMsgBox is a predifined GUI with some more options. Utilizing MsgBox a lot you'll soon reach a point where this or that could be done better / different. At that point you'll either code your own GUI... or remember this UDF with a higher degree of freedom :blink:...

#16 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,119 posts

Posted 24 July 2010 - 02:14 PM

KaFu,

Thank you for that. You were very polite....... :blink:

DjATUit,

As KaFu has pointed out, there are a few more user definable options available with this UDF - read the list at the top of the thread to see why you might want to use it in place of a normal MsgBox. ;)

But if you feel you must use a standard MsgBox, you might like to look at SmOke_N's MsgBoxUDF here. :P

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#17 meisandy

meisandy

    Prodigy

  • Active Members
  • PipPipPip
  • 153 posts

Posted 25 July 2010 - 03:23 PM

Thanks for explaining - I just wasn't sure!

It's not that I don't like the script/idea, it's just I coudn't see the fact that you could replace about 5 lines with 1!

Thanks

#18 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,666 posts

Posted 05 August 2010 - 07:46 PM

I liked the Extended Message Box idea so much that I have added it to the scripts I write now instead of the default message box. I even came up with an interesting addition to it for my own use. I am just learning the AutoIt scripting language, and wanted to try something out using your message box as a base. I added an additional parameter to the function call which I called $Random, what this does is when the user puts any non-zero number in the parameter the ext. msg box function will now change the background color to a random color every ($Random * 1000) milliseconds. I was writing a script that has a message box pop up after copying files to tell the user that it finished, and I wanted to make it have a little more impact and be more noticeable so I threw this twist to your script together.
You call the function with this line.

    _ExtMsgBox($Icon, $Button, $Title, $Text, $Timeout, $Pos, $Vpos,$Random) ; Where $Random is any positive number and it causes a delay of this many seconds


Change line 188 to this:
Func _ExtMsgBox($iIcon, $iButton, $sTitle, $sText, $iTimeout = 0, $hWin = "", $iVPos = 0, $Random = 0)


And this is added to the _ExtMsgBox function itself starting at line 406

$Timer = TimerInit() While 1     $Delay = TimerDiff($Timer)     If $Random > 0 Then         $DelayTime = ($Random * 1000) ; Multiply $Random times 1000 for a delay in milliseconds         If $Delay > $DelayTime Then             GUISetBkColor(Random(1, 32365, 1))             $Timer = TimerInit()         EndIf     EndIf


I'm not sure if anyone else would have a use for this but I thought it was a cool change. :blink:

Edited by BrewManNH, 05 August 2010 - 07:47 PM.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#19 Melba23

Melba23

    I'm old - what's your excuse?

  • Moderators
  • 22,119 posts

Posted 05 August 2010 - 07:58 PM

BrewManNH,

A nice modification. :blink:

I hope to be able to be able to figure out this language one day

You are well on your way! ;)

M23
StringSize - Automatically size controls to fit text                                                               ExtMsgBox - A user customisable replacement for MsgBox
Toast - Small GUIs which pop out of the Systray                                                                Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command                                   GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI                                      NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure      Notify - Small notifications on the edge of the display
Date_Time_Convert - Easily convert date/time formats, including the language               GUIListViewEx - Insert, delete, move, drag, sort and edit ListView items

#20 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,666 posts

Posted 25 October 2010 - 03:04 AM

I have found an issue with this UDF, which is probably caused by the StringSize.au3 UDF that it calls, but I'm not sure of that part. What I have found, and something other users should be aware of, is in my media player I started to incorporate the EMB UDF to make the messages displayed a little more unique. What I found is that after calling an ExtMsgBox function, my media player's controls were getting all messed up. My timer, progress bar, and volume control indicator wouldn't update after. My help menu message boxes were getting the Timer text updates instead of their usual text.

I believe it is because StringSize, or the EMB is creating ControlIDs that are causing the media player's control IDs to get changed, so I'm updating the wrong controls after calling this function. I have gotten around the problem by only using it when the playlist is empty, so nothing will be playing afterward, or when I'm exiting the script.

I still find this UDF to be a great addition to my toolbox, but there are limitations to using it that I thought others should be aware of.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users