Jump to content

Extended Message Box - New Version: 16 Feb 24


Melba23
 Share

Recommended Posts

Hi Melba

It would be nice if Extended Message Box didn't truncate long titles when the text is short.

I hesitate to provide an example as my monitor DPI setting is non-standard, and it's trivial to recreate the effect.

My apologies if this subject has been covered before but you can appreciate the difficulty in searching for "title" and/or "width" in this topic!

Link to comment
Share on other sites

  • Moderators

jrsofsd,

No, I think you are the first to ask about that. I will look into it. :)

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

jrsofsd,

Have a play with this and see what you think: :)

<snip>

 

An example to show it working:

#include "ExtMsgBox_Mod.au3"

_ExtMsgBox(64, "OK", "Title", "Text Sets Dialog Width Here")
_ExtMsgBox(48, "OK", "Much Longer Title To Set Dialog Width Here", "Text")
_ExtMsgBox(16, "OK", "Still A Much Longer Title...But Just To Show That There Are Limits Which Cause Truncation If It Gets Far Too Long", "Text")
There is a SWAG factor in the code at present to account for the EMB title bar icon and [X]. If it is not correct for your machine, then change this part of line #266 to a more suitable value:

<snip>

I will work today on trying to get the correct values for those elements programmatically so as to avoid the guesswork. ;)

M23

Edit: Not too difficult to calculate the available titlebar width - new beta above. ;)

Edited by Melba23
Beta code removed

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

jrsofsd,

 

I take it you did not use an icon - I will look at recoding to deal with that case.

 

 

 

M23

 

Edit: Try this new Beta: <snip>

 

Edited by Melba23
Removed Beta code

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

Hi Melba

This is the data on my system immediately after the line starting with "Local $aTitleSize ="

  aTitleSize[2]:        142
  iMsg_Width minus 70:  80
  g_aEMB_Settings[7]:   500
  g_aEMB_Settings[12]:  83

The dialog width is adjusted in the line after "; Adjust dialog width up to absolute dialog width value".

The adjusted width:
  Dialog Width:         225

The window width as measured with Autoit Window Info is 231, the "bang" icon is 32x32.

Hope this helps.

Link to comment
Share on other sites

  • Moderators

jrsofsd,

 

Hope this helps

Quite frankly: No. I get very different values for the measured strings - and if you have "non-standard DPI settings" then my StringSize UDF is unlikely to return values that will display correctly. So I am grateful that you pushed me to amend the UDF to allow the title to set the dialog width if necessary, but I am not going to try to develop it to deal with user-specific machine settings. Sorry about that.

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

Melba

I changed my DPI setting to 100% (default) and tried the test at 800x600 screen resolution:

    aTitleSize[2]:       113
  iMsg_Width minus 70:  80
  g_aEMB_Settings[7]:  500
  g_aEMB_Settings[12]:  67
  Dialog Width:        180

The results were the same for 1024x768 and 1280x1024.

Is it possible you posted the wrong modified script?

I won't be able to test again until Monday...
 

Link to comment
Share on other sites

  • Moderators

jrsofsd,

Those figures are what I get - and I get the dialog with the title correctly displayed either with or without an icon:

 

and the code used is exactly as posted above. So I am at a loss to explain why it does not work for you - can you post a screenshot so I can see what you actually get displayed?

M23

Edited by Melba23

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

Hi Melba

A can of worms.

I performed the following:
    Drivers    - Updated my graphics drivers to the current release.
    Fonts      - Control Panel -> Fonts -> Font Settings -> Restore default font settings
    DPI        - Set to 100 (default),

The title was still truncated, so I changed themes. Once I discovered that the
Windows 7 Basic theme worked, I tried changing the following settings in a
failing theme:
    Cleartype  - on/off. No change.
    DPI        - "Use Windows XP style DPI scaling" had no effect.
    Resolution - I tested with 800x600, 1024x768, and 1280x1024. No change in results.

Again, of the themes I tested, only Windows 7 Basic displayed the title without truncation.
All tested Aero themes failed.
Note that the info for #1 and #3 is identical, but #1 is OK and #3 fails.

Non-Aero Themes

    1. Windows 7 Basic - OK:
        aTitleSize string:        OCR Detection Status
        aTitleSize height:        15
        aTitleSize Rwisth:        113
        aTitleSize Rheight:        19
        Default Font Name:        Segoe UI
        Default Font Size:        9
        Font Name:                9
        Font Size:                Segoe UI
        iMsg_Width minus 70:    80
        g_aEMB_Settings[7]:        500
        g_aEMB_Settings[12]:    67
        Dialog Width:            180

    2. Windows Classic - Failed:
        aTitleSize string:        OCR Detection Status
        aTitleSize height:        13
        aTitleSize Rwisth:        105
        aTitleSize Rheight:        17
        Default Font Name:        Tahoma
        Default Font Size:        8.5
        Font Name:                8.5
        Font Size:                Tahoma
        iMsg_Width minus 70:    80
        g_aEMB_Settings[7]:        500
        g_aEMB_Settings[12]:    50
        Dialog Width:            155

Aero Themes (all tested Aero themes failed).

    3. Aero - Windows 7  - Failed:
        aTitleSize string:        OCR Detection Status
        aTitleSize height:        15
        aTitleSize Rwisth:        113
        aTitleSize Rheight:        19
        Default Font Name:        Segoe UI
        Default Font Size:        9
        Font Name:                9
        Font Size:                Segoe UI
        iMsg_Width minus 70:    80
        g_aEMB_Settings[7]:        500
        g_aEMB_Settings[12]:    67
        Dialog Width:            180

    4. Aero - High Contrast #1  - Failed:
        aTitleSize string:        OCR Detection Status
        aTitleSize height:        13
        aTitleSize R width:        105
        aTitleSize R height:    17
        Default Font Name:        Microsoft Sans Serif
        Default Font Size:        8.5
        Font Name:                8.5
        Font Size:                Microsoft Sans Serif
        iMsg_Width minus 70:    80
        g_aEMB_Settings[7]:        500
        g_aEMB_Settings[12]:    52
        Dialog Width:            157

    5. Aero - Architecture  - Failed:
    6. Aero - Nature        - Failed:


I refuse to apologize for the formatting, this new editor is seriously crippled. A step backwards.

Windows Classic.jpg

Windows 7 Basic.jpg

Aero - Windows 7.jpg

Aero - High Contrast #1.jpg

Edited by jrsofsd
Link to comment
Share on other sites

  • Moderators

jrsofsd,

Thanks for doing so much and reporting so comprehensively.  There appears to be a problem in the values returned by the SystemMetric call for the icon and button widths on the title bar for some of the themes - by eye the button of the Win 7 Aero is significantly wider than the Win 7 Classic and yet the values in $g_aEMB_Settings[12] are the same. So little wonder the sizing does not work correctly.  I will look into that problem when I next have time (we have house guests for the next few days).

But it looks as though the titles are very nearly complete.  Perhaps if the button and icon borders were added to the total as well - try changing the code within the "Default settings" section to read:

$g_aEMB_TempArray = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 11) ; Title bar icon width
$g_aEMB_Settings[12] = $g_aEMB_TempArray[0]
ConsoleWrite("Icon: " & $g_aEMB_TempArray[0] & @CRLF)
$g_aEMB_TempArray = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 30) ; Title bar button width
$g_aEMB_Settings[12] += $g_aEMB_TempArray[0]
ConsoleWrite("Button: " & $g_aEMB_TempArray[0] & @CRLF)
$g_aEMB_TempArray = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 7) ; GUI frame width (also used for buttons)
$g_aEMB_Settings[12] += ($g_aEMB_TempArray[0] * 4)
ConsoleWrite("Edge: " & $g_aEMB_TempArray[0] & @CRLF)
$g_aEMB_TempArray = 0

On my Win 7 Classic it gives a little too much space, so it might well just suffice for the other themes.

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

Hi Melba

Thanks for sticking with me on this  My assumption was that both of us were "correct" :)

The latest code works fine on my 800x600 custom Aero theme with 125% DPI scaling. My graphics setup is outside the mainstream but not by choice. I'm legally blind, and do everything I can to make text legible and still have a usable system. The way I see it (insert joke here) I'm a good test case.


Thanks again for some code I can't work without, especially StringSze and GuiListViewEx!

 

Link to comment
Share on other sites

  • Moderators

jrsofsd,

Thanks for sticking with me on this

No problem - always happy to get my UDFs working properly for everyone. And in your case in particular.

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

jrsofsd,

I found this quote while researching the incorrect SystemMetric values with Aero themes:

 ...Aero [has a] serious appcompat problem. Windows intentionally lies about the window rectangle and border size. [...] Without the lie, the window would end up with a client area that's too small.

So it looks as if the problem is well-known. I will look into how the UDF could check if Aero is enabled and if it is then add a suitable "fudge factor" to compensate.

M23

Edited by Melba23
Expanded information

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

jrsofsd,

I think I have a working solution - checking for the smaller buttons which appear in some themes, as well as for Aero being enabled and Windows telling bare-faced lies - look in the Default settings section to see how it works. On my machine this Beta shows the full titles for all the EMBs in the example script below when using all the themes you tested above (other than when there is a deliberate forced error in the last call) - can you try on your machine and see if you get the same results?

#include "ExtMsgBox_Mod.au3"

_ExtMsgBox(0, "OK", "OCR Detection Status", "Connected")
_ExtMsgBox(64, "OK", "OCR Detection Status", "Connected")
_ExtMsgBox(64, "OK", "Title", "Text Sets Dialog Width Here")
_ExtMsgBox(0, "OK", "Much Longer Title To Set Dialog Width Here", "Text")
_ExtMsgBox(48, "OK", "Much Longer Title To Set Dialog Width Here", "Text")
_ExtMsgBox(16, "OK", "Still A Much Longer Title...But Just To Show That There Are Limits Which Cause Truncation If It Gets Far Too Long", "Text")

<snip>

M23

Edited by Melba23
Beta code removed

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

Hi Melba

All The examples work fine (except as the last, as expected).

Nice bit of detective work, especially since the Stackoverflow post just states that Windows lies, not how to compensate for the lie! I like the use of the ternary operator.

Link to comment
Share on other sites

  • Moderators

jrsofsd,

Great news - I will release a new version later today.

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

[NEW VERSION] 6 May 15

Changed: If the title is wider than the text (with or without an icon) the EMB will expand to display the title in full - up to the maximum width allowed.

Thanks to jrsofsd who asked for the change.

New UDF and examples in first post.

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

Hi Melba

I've read the ExtMsgBox and StringSize code more than I had ever planned. Now I'm curious as to why there two different methods of retrieving the "default" (message box) font data.

ExtMsgBox retrieves name and size from the Autoit theme specific "font used to display messages in a message box" - MessageFont in Non-Client Metrics

StringSize retrieves the font metrics for the system "font used in message boxes" - TMT_MSGBOXFONT in  GetThemeSysFont function

Do you mind commenting?

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...