Jump to content

Extended Message Box - New Version: 16 Feb 24


Melba23
 Share

Recommended Posts

  • Moderators

wakillon,

What @error value do you get returned? If I increase the font size too much I get @error = 5 which means that the max width of the EMB is too small to contain the longest word of the string - in this case the URL. :)

The solution - increase the absolute max size ($iMsg_Width_abs) of the EMB by changing this line:

Local $iMsg_Width_max = 370, $iMsg_Width_min = 150, $iMsg_Width_abs = 500

If I set that value to 800, I can increase the size of the font to 24 without problem - although you may then want to keep the default font for the buttons as it overflows quite a lot! ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

wakillon,

What @error value do you get returned? If I increase the font size too much I get @error = 5 which means that the max width of the EMB is too small to contain the longest word of the string - in this case the URL. :)

The solution - increase the absolute max size ($iMsg_Width_abs) of the EMB by changing this line:

Local $iMsg_Width_max = 370, $iMsg_Width_min = 150, $iMsg_Width_abs = 500

If I set that value to 800, I can increase the size of the font to 24 without problem - although you may then want to keep the default font for the buttons as it overflows quite a lot! ;)

M23

I set $iMsg_Width_abs to 800 without result...

I get not @error value, in fact i get nothing, it run and i wait....but nothing happens, i must close the script manually...

if i set fontsize to 9 it works, but not to 10,11 or 12.

Have you tried my last post script ? did it works for you ? Posted Image

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Moderators

wakillon,

I used exactly what you posted and it works perfectly IF the URL fits into the EMB at the required font size (It works for 16, not 18). ;)

Are you saying that you get no return AT ALL from the _ExtMsgBox call - not even an @error? :idiot:

What return do you get from the _ExtMsgBoxSet call (not that I believe that is part of the problem)? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

wakillon,

I used exactly what you posted and it works perfectly IF the URL fits into the EMB at the required font size (It works for 16, not 18). ;)

Are you saying that you get no return AT ALL from the _ExtMsgBox call - not even an @error? :idiot:

What return do you get from the _ExtMsgBoxSet call (not that I believe that is part of the problem)? :)

M23

Like i said, it run and i wait for the msgbox display, but , nothing ! ( when i say i wait ; it's several seconds ~ 30 )

and after i must close manually script...

Absolutely no value are returned.Posted Image

With fontsize set to 9, it works.

Edit : At first I thought my default font was the problem, but even i set to Windows default font, it doesn't work...

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Moderators

wakillon,

Run this and see if what you get returned matches the input: :)

#include <ExtMsgBox.au3>

_ExtMsgBoxSet ( 3, 0, 0xFFFF00, 0xFF0000, 12, "MS Sans Serif" )

ConsoleWrite( _
            "Style: " & $iEMB_Style & @CRLF &  _
            "Just:  " & $iEMB_Just & @CRLF &  _
            "BkCol: " & "0x" & Hex($iEMB_BkCol, 6) & @CRLF &  _
            "Col:   " & "0x" & Hex($iEMB_Col, 6) & @CRLF &  _
            "Name:  " & $sEMB_Font_Name & @CRLF &  _
            "Size:  " & $iEMB_Font_Size & @CRLF)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I get this :

Style: 3

Just: 0

BkCol: 0xFFFF00

Col: 0xFF0000

Name: MS Sans Serif

Size: 12

+>18:02:40 AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 1.619

I have tried like this ( supressing the url line ) with a fontsize to 12 and it works !

#include <ExtMsgBox.au3>

$_YoutubeUrl = 'http://www.youtube.com/watch?v=XPBwXKgDTdE'
_ExtMsgBoxSet ( 3, 0, 0xFFFF00, 0xFF0000, 12, "MS Sans Serif" )
;$sMsg = $_YoutubeUrl & @CRLF
$sMsg = "Do you want download it ?"
$iRetValue = _ExtMsgBox ( 128, "Yes|No", "Match !", $sMsg, 10 )
ConsoleWrite ( "$iRetValue : " & $iRetValue & @CRLF )

I don't understand...

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Moderators

wakillon,

Try reducing the length of the URL code and see if it works then. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

wakillon,

It is normal that the EMB does not display if the text cannot fit into the preset max width. The last update added an absolute max width and allowed the size to increase up to that value if needed to fit long strings.

What is not normal is that absolutely nothing happens and the script hangs. When I set too large a font size I got the expected @error = 5 return, so I am at a loss as to why you do not. :)

All I can suggest now is trying the same code, gradually increasing the length of the URL and see if it returns the expected error or hangs when the string gets too long. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

My url is not so long, even with a fontsize of 12.

To be sure it's not my PC the cause of the hangs, i have tried with another computer on XP SP3 too and...

It hangs too !

If i reduce the url or reduce the fontsize to 9, it works.Posted Image

it's boring...

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Moderators

wakillon,

I have just run the exact script you posted on an XP SP3 machine and it works as I expected: OK until the font size gets over 16 and then @error = 5 - no hangs at all. So I am completely baffled - I cannot reproduce your symptoms so I cannot really offer any more help. ;)

Perhaps the UDF does not like the garlic in your French OS? :) Although we eat so much of it at my table I am sure my machine is completely impregnated too! :idiot:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

wakillon,

Try putting Opt("TrayIconDebug", 1) at the top of the script and run it. The icon tool tip should then give us a clue as to where it is hanging. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

wakillon,

Try putting Opt("TrayIconDebug", 1) at the top of the script and run it. The icon tool tip should then give us a clue as to where it is hanging. :)

M23

Thanks a lot Melba !

your idea permit me to see that it was "stringsize.au3" causing problem !

script was blocked to line 155, that's why there was no return !

Posted Image

I update my stringsize.au3 and retry succesfully with fontsize 24 ! Posted Image

Viva Melba ! Posted Image

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

  • Moderators

wakillon,

Splendid! :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • 2 months later...

Hi Melba23

what kind of window style that can disable the exit button just like the standard message box exit button,check the below picture.

Posted Image

i wrote a message box via your extended msgbox UDF,my script will call it when need popup some messages, some controls on my GUI would still be in disable status if press the exit button at that time ,just in case this would happen,so i need a windows style can disable exit button.

Link to comment
Share on other sites

If you look in the ExtMsgBox.au3 file for this line:

Local $hMsgGUI = GUICreate($sTitle, $iMsg_Width, $iMsg_Height, $iHpos, $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, $iParent_Win)

You can change $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, to this, $iVPos, 0x80000000, $iExtStyle,. This will create the GUI as a pop up window; no title bar, no sysmenu, no taskbar icon, no frame. That's one way of doing it.

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 XP, 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!

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.

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 editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

If you look in the ExtMsgBox.au3 file for this line:

Local $hMsgGUI = GUICreate($sTitle, $iMsg_Width, $iMsg_Height, $iHpos, $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, $iParent_Win)

You can change $iVPos, BitOR(0x80880000, 0x00C00000), $iExtStyle, to this, $iVPos, 0x80000000, $iExtStyle,. This will create the GUI as a pop up window; no title bar, no sysmenu, no taskbar icon, no frame. That's one way of doing it.

thanks BrewManNH for the line, i tried this BitOR(0x80000000, 0x00C00000) just what i need , i'm confused a window has so much styles :unsure: Edited by lhw
Link to comment
Share on other sites

  • 2 months later...

Nice UDF.

I've only just noticed your UDF and haven't started using it yet. But I wanted to let you know what I've found. I will start using your "ExMsgBox.au3" it in my code and expect it to be very useful.

Something I've run into with trying to use Tab Characters in strings. I've seen that StringSize doesn't report line lengths correctly on the following:

If the line with the Tab shows longer (not same as length of its string) then the other lines w/o tabs the msgbox doesn't display all the text.

I figure StringLen correctly reports the length of the the string and just counts the Tab Character as one Charater. but not the length with the Tabs expanded. Now I have to admit this is just a guess, but by playing with my own MsgBox I found that in the line with Tab Characters I expanded the Tab Character to spaces before calling the StringLen everything looked fine.

To show you what I mean I've added the following to your "ExtMsgBox Example.au3" in the "Test 2" section before the first tab string:

$sMsg &= @TAB & @TAB & "A line long enough not to scroll" & @CRLF

which then looks like:

Case $hButton2

            ; Hide the main GUI to centre the message box on screen
            GUISetState(@SW_HIDE, $hTest_GUI)

            ; Change font and justification, leaving colours unchanged
            _ExtMsgBoxSet(5, $SS_LEFT, -1, -1, 12, "Arial")

            $sMsg = "As 'EMB Test' is hidden, this is centred on screen" & @CRLF & @CRLF
            $sMsg &= "It has:" & @CRLF
            $sMsg &= @TAB & @TAB & "A line long enough not to scroll" & @CRLF
            $sMsg &= @TAB & "An Info icon," & @CRLF
            $sMsg &= @TAB & "1 offset button"  & @CRLF
            $sMsg &= @TAB & "Left justified text," & @CRLF
            $sMsg &= @TAB & "Default button text," & @CRLF
            $sMsg &= @TAB & "No Taskbar button and " & @CRLF
            $sMsg &= @TAB & "TOPMOST set" & @CRLF& @CRLF
            $sMsg &= "The width is set by the maximum line length" & @CRLF & @CRLF
            $sMsg &= "(which is less than max message box width)" & @CRLF & @CRLF
            $sMsg &= "It will time out in 20 seconds"

            ; Use $MB_ constants and set timeout value
            $iRetValue = _ExtMsgBox ($MB_ICONASTERISK, "Default Font", "Test 2", $sMsg, 20, $hTest_GUI)
            ConsoleWrite("Test 2 returned: " & $iRetValue & @CRLF)

            ; Reset to default
            _ExtMsgBoxSet(Default)

            ; Show the main GUI again
            GUISetState(@SW_SHOW, $hTest_GUI)
            WinSetOnTop($hTest_GUI, "", 1)
            WinSetOnTop($hTest_GUI, "", 0)

When I click on "Test 2" On my computer (WinXP SP3) I don't see all the text in the msgbox.

The only way I could get around this was with my own MsgBox (using your StringSize) and expanding the Tab character for each line. This is lifted out of my own "MyMsgBox.au3" Code (which can do very little compared to yours). I haven't tried it in yours yet.

Func StringTabSpace($str)
    Local $i,$s,$chr
    Local $ai,$array
    Local $len,$pos
    Local $f,$t

    $s = StringStripCR($str)
    $array = StringSplit($s,@LF)

    For $ai = 1 to $array[0]
        $s = ""
        $len = StringLen($array[$ai])
        $pos = 1
        For $i = 1 to $len
            $chr = StringLeft($array[$ai],1)
            $array[$ai] = StringTrimLeft($array[$ai],1)
            If $chr = @TAB Then
                For $f = Mod($pos,8) to 8
;                   ConsoleWrite("f=["&$f&"]" & @CRLF)
                    $s &= " "
                    $pos += 1
                Next
            Else
                $s &= $chr
                $pos += 1
            EndIf
        Next
        $array[$ai] = $s
    Next
;   _ArrayDisplay($array,"array")
    $s = ""
    For $ai = 1 to $array[0]
        $s &= $array[$ai] & @LF
    Next
    $s = StringTrimRight($s,1)

    Return $s
EndFunc

I can already see that this works fine with my simple left justified MsgBox's, but not sure how to implement it with all the formats yours can handle.

Thanks for all your hard work,

Joe

Link to comment
Share on other sites

  • Melba23 changed the title to Extended Message Box - New Version: 16 Feb 24
  • Jon unfeatured this topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...