Jump to content

Recommended Posts

Posted (edited)

Good day,

Nine had sent me this:

#include "ExtMsgBox.au3"

Local $sResult = "Very very long long test text that should be cut somewhere into the line, so need to be extended" & @CRLF & _
  "Yet, another Very very long long test text that should be cut somewhere into the line, so need to be extended" & @CRLF & _
  "Not so long test text that should be cut somewhere into the line, so need to be extended" & @CRLF & _
  "Quite short test text that should NOT be cut somewhere into the line"

_ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 800)

_ExtMsgBox(64, "Ok", "Test", $sResult)

However, as I am unable to locate a simplified explanation for the above - and with the information in the UDF being "way-beyond-my-pay-grade", can someone please explain to me what is going in each of the above parameters?

May someone explain precisely what "_ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 800)" is referring to here?

I am attempting to extend the width of the box to accept a single line with 140 textual characters.
• See attached...

Any assistance in this matter would be greatly appreciated!

PS: I cannot employ "& @CRLF & _" as the entire text is to be validated. I do hope that I am explaining this properly.

sample.png

Edited by mr-es335
  • Moderators
Posted

mr-es335,

I rather pride myself on the clarity of my UDF function headers, so I am somewhat disappointed to hear that you are having difficulties in understanding the various parameter values. If you would explain just which of the explanations are causing you probems I will attempt to explain.

As to your requirement to display 140 characters in an ExtMsgBox, I suggest you choose a font and then use my StringSize UDF (which is included in the ExtMsgBox download) to measure just how wide this string would be. You can then use this value as the $iWidth_Abs parameter - althugh I would suggest adding a decent margin on either side!

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

 

Posted (edited)

@Melba23  I have a question about $iWidth_Abs parameter.  I tried to figure out the usage you got in mind with this parameter.  Looking at the code, there is nothing obvious that helped me understand.

Running this code, produces the following result :

#include "ExtMsgBox.au3"
#include <String.au3>

Local $sResult = _StringRepeat("1234567890", 14)
_ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 1000)
_ExtMsgBox(64, "Ok", "Test", $sResult)

image.png.5930b1e3e56b628b5cd7b52176c2685f.png

And this code gives the exact same result :

#include "ExtMsgBox.au3"
#include <String.au3>

Local $sResult = _StringRepeat("1234567890", 14)
_ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 1000, 1400)
_ExtMsgBox(64, "Ok", "Test2", $sResult)

image.png.612413e42f52bfe587a92eafd7c327f8.png

Edited by Nine
  • Moderators
Posted

Nine,

There is no difference because in both cases the EMB is sufficently large to fit the unbroken string. Try running this and you will see a difference:

#include "ExtMsgBox.au3"
#include <String.au3>

; Create long string
Local $sResult = _StringRepeat("1234567890", 14)

; Check of string length
$aRet = _StringSize($sResult)
ConsoleWrite($aRet[2] & @CRLF) ; I get 840 pixels as the width of the string

; Try EMB with $iWidth_Abs too small
_ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 500)

$iRet = _ExtMsgBox(64, "Ok", "Test", $sResult)
ConsoleWrite($iRet & " - " & @error & @CRLF) ; Should fail with "-1 - 6" return

; Now try with increased max width
_ExtMsgBoxSet(1, 0, Default, Default, Default, Default, 1000)

; And it works!
$iRet = _ExtMsgBox(64, "Ok", "Test", $sResult)
ConsoleWrite($iRet & " - " & @error & @CRLF)

The width parameters work like this:

-   There is a minimum width of 370 pixels (hard coded) to make sure there is always room for at least a bit of text and a reasonably sized button.

-   The normal maximum width is also set to 370 as it is expected that messages are not normally hugely long and can easily be broken (using StringSize) to fit, although this can be increased using the $iWidth parameter in _ExtMsgBoxSet to cater for longer messages where you need to avoid a tall, thin EMB.

-   Finally, if you think there might be a long section of characters which cannot be broken by StringSize (as in this case) then you need to set an absolute width which will allow the EMB to expand so it can display the unbroken string - this is limited to @DesktopWidth - 20 to make sure that the EMB actually fits on the display.

Clearer now?

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

 

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
  • Recently Browsing   0 members

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