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