Sign in to follow this  
Followers 0
bills

How do i make a messagebox scollable?

12 posts in this topic

#1 ·  Posted (edited)

Ive got to much text in my messagebox for it to fit my screen.

Id like it to fit the screen and become scrollable.

How can i do that?

//Bill

Edited by bills

Share this post


Link to post
Share on other sites



Ive got to much text in my messagebox for it to fit my screen.

Id like it to fit the screen and become scrollable.

How can i do that?

//Bill

Make a custom "MsgBox" using a GUI and Edit Control.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Can you give me an example?

Share this post


Link to post
Share on other sites

Can you give me an example?

Not without writing it myself.

Or using the search feature

You should be able to find plenty of examples in the above.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

I cant get it to work using this.

What i need is a simple messagebox which i can give a width and height and make scrollable.

Ive tried searching the forums but found nothing like this.

Doesnt anyone know how to do this?

/Bill

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I cant get it to work using this.

What i need is a simple messagebox which i can give a width and height and make scrollable.

Ive tried searching the forums but found nothing like this.

Doesnt anyone know how to do this?

/Bill

Yes, many of us "Know" how... but I've given you a "search" criteria, in that criteria, you'll see how to do it... also, I made a custom MsgBox a while ago, you can study that and see how you could put an edit box in there with the "GUI Styles $WS_HSCROLL/$WS_VSCROLL" to help you with the scrolling issue.

Here is the link where I made the custom message box (It's an Adaware automation script, but it has the custom message box in it).

Link: http://www.autoitscript.com/forum/index.php?showtopic=20133

UDF:

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = '')
    Local $StrnLenText = MsgLongestString($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 5
    Local $Button1Txt = "Full Scan"
    Local $Button2Txt = "Smart Scan"
    Local $MsgValue = 0
    Local $Timer = ''
    $iMsgBox = GUICreate($mb_Title, $StrnLenText + 190, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    GUICtrlCreateLabel($mb_Text, 60, 10)
    GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $FullScan = GUICtrlCreateButton($Button1Txt, 30 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt), 25)
    $SmartScan = GUICtrlCreateButton($Button2Txt, 100 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button2Txt), 25)
    
    GUISetState()
    If $mb_Time <> '' Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
        Case $imsg = $FullScan
                $MsgValue = 6
                ExitLoop
            Case $imsg = $SmartScan
                $MsgValue = 7
                ExitLoop
            Case $mb_Time <> ''
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc
Func MsgLongestString($sText)
    Local $sSplit = StringSplit($sText, @CRLF)
    Local $Times = ''
    If Not @error Then
        ArraySortByLen($sSplit)
        If StringLen($sSplit[1]) <= 100 Then $Times = 2.25
        If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 2.5
        If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 3
        If StringLen($sSplit[1]) >= 202 Then $Times = 3.25
        Return Round(StringLen($sSplit[1])*$Times)
    Else
        If StringLen($sText) <= 100 Then $Times = 2.25
        If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 2.5
        If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 3
        If StringLen($sText) >= 202 Then $Times = 3.25
        Return Round(StringLen($sText)*$Times)
    EndIf
EndFunc

Func ArraySortByLen(ByRef $nArray, $Start = 1)
    For $i = $Start To UBound($nArray) - 2
        Local $SE = $i
        For $x = $i To UBound($nArray) - 1
            If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
        Next
        Local $HLD = $nArray[$i]
        $nArray[$i] = $nArray[$SE]
        $nArray[$SE] = $HLD
    Next
EndFunc
(You'd replace the Label with Edit).

But I think more with your statement, you're looking for someone to write it for you (well the statement and the lack of code effort).

Edit:

Forgot 2 of the other UDFs needed for that.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Hey guys!

I finally understood how you meant.

SmOke_N you missundestood me before. I didnt want you guys to write it for me, just hoped it could be done in a regular messagebox (not gui).

Anyways, problem solved :rolleyes: Thank you all!

//Bill

Share this post


Link to post
Share on other sites

Thanks SmOke_N, i always wanted to do function that will allow showing all text even if the text is too big for the screen...

Here i made a litle changing, now there is two litle custom scroll controls :rolleyes: (if the text is to long):

$Text = ""
For $i = 1 To 50
    $Text &= "Line " & $i & " Line " & $i & " Line " & $i & @CRLF
Next

_MsgBox(104, "Test", $Text)

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
    Local $StrnLenText = MsgLongestString($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
    If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 200
    Local $Button1Txt = "OK"
    Local $Button2Txt = "Cancel"
    Local $MsgValue = 0
    Local $Timer = ''
    Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
    Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 190, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, 64+128+2048+4, 0x990)
    GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $Button1 = GUICtrlCreateButton($Button1Txt, 30 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt), 25)
    $Button2 = GUICtrlCreateButton($Button2Txt, 100 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button2Txt), 25)
    
    If $NumberOfLines = (@DesktopHeight - 200) Then
        $ScrollLabel1 = GUICtrlCreateLabel("т", 40, ((100 + $NumberOfLines)/2)+20, 20)
        GUICtrlSetTip(-1, "Click here to scroll Down")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
        $ScrollLabel2 = GUICtrlCreateLabel("с", 40, ((100 + $NumberOfLines)/2)-20, 20)
        GUICtrlSetTip(-1, "Click here to scroll UP")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
    EndIf
    
    GUISetState()
    If $mb_Time <> 0 Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $Button1
                $MsgValue = 6
                ExitLoop
            Case $imsg = $Button2
                $MsgValue = 7
                ExitLoop
            Case $imsg = $ScrollLabel1
                ControlSend($iMsgBox, "", $Edit, "{PgDn}")
            Case $imsg = $ScrollLabel2
                ControlSend($iMsgBox, "", $Edit, "{PgUp}")
            Case $mb_Time <> 0
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc

Func MsgLongestString($sText)
    Local $Times = ''
    Local $sSplit = StringSplit($sText, @CRLF)
    If Not @error Then
        ArraySortByLen($sSplit)
        If StringLen($sSplit[1]) <= 100 Then $Times = 2.25
        If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 2.5
        If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 3
        If StringLen($sSplit[1]) >= 202 Then $Times = 3.25
        Return Round(StringLen($sSplit[1])*$Times)
    Else
        If StringLen($sText) <= 100 Then $Times = 2.25
        If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 2.5
        If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 3
        If StringLen($sText) >= 202 Then $Times = 3.25
        Return Round(StringLen($sText)*$Times)
    EndIf
EndFunc

Func ArraySortByLen(ByRef $nArray, $Start = 1)
    For $i = $Start To UBound($nArray) - 2
        Local $SE = $i
        For $x = $i To UBound($nArray) - 1
            If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
        Next
        Local $HLD = $nArray[$i]
        $nArray[$i] = $nArray[$SE]
        $nArray[$SE] = $HLD
    Next
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Thanks SmOke_N, i always wanted to do function that will allow showing all text even if the text is too big for the screen...

Here i made a litle changing, now there is two litle custom scroll controls :rolleyes: (if the text is to long):

$Text = ""
For $i = 1 To 50
    $Text &= "Line " & $i & " Line " & $i & " Line " & $i & @CRLF
Next

_MsgBox(104, "Test", $Text)

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
    Local $StrnLenText = MsgLongestString($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
    If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 200
    Local $Button1Txt = "OK"
    Local $Button2Txt = "Cancel"
    Local $MsgValue = 0
    Local $Timer = ''
    Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
    Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 190, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, 64+128+2048+4, 0x990)
    GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $Button1 = GUICtrlCreateButton($Button1Txt, 30 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt), 25)
    $Button2 = GUICtrlCreateButton($Button2Txt, 100 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button2Txt), 25)
    
    If $NumberOfLines = (@DesktopHeight - 200) Then
        $ScrollLabel1 = GUICtrlCreateLabel("т", 40, ((100 + $NumberOfLines)/2)+20, 20)
        GUICtrlSetTip(-1, "Click here to scroll Down")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
        $ScrollLabel2 = GUICtrlCreateLabel("с", 40, ((100 + $NumberOfLines)/2)-20, 20)
        GUICtrlSetTip(-1, "Click here to scroll UP")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
    EndIf
    
    GUISetState()
    If $mb_Time <> 0 Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $Button1
                $MsgValue = 6
                ExitLoop
            Case $imsg = $Button2
                $MsgValue = 7
                ExitLoop
            Case $imsg = $ScrollLabel1
                ControlSend($iMsgBox, "", $Edit, "{PgDn}")
            Case $imsg = $ScrollLabel2
                ControlSend($iMsgBox, "", $Edit, "{PgUp}")
            Case $mb_Time <> 0
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc

Func MsgLongestString($sText)
    Local $Times = ''
    Local $sSplit = StringSplit($sText, @CRLF)
    If Not @error Then
        ArraySortByLen($sSplit)
        If StringLen($sSplit[1]) <= 100 Then $Times = 2.25
        If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 2.5
        If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 3
        If StringLen($sSplit[1]) >= 202 Then $Times = 3.25
        Return Round(StringLen($sSplit[1])*$Times)
    Else
        If StringLen($sText) <= 100 Then $Times = 2.25
        If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 2.5
        If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 3
        If StringLen($sText) >= 202 Then $Times = 3.25
        Return Round(StringLen($sText)*$Times)
    EndIf
EndFunc

Func ArraySortByLen(ByRef $nArray, $Start = 1)
    For $i = $Start To UBound($nArray) - 2
        Local $SE = $i
        For $x = $i To UBound($nArray) - 1
            If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
        Next
        Local $HLD = $nArray[$i]
        $nArray[$i] = $nArray[$SE]
        $nArray[$SE] = $HLD
    Next
EndFuncoÝ÷ Ûú®¢×¢íý­ìÊ&zé캷²Øb³Z·*.ÁêÞ¶¼¢hva¢è!jëh×6$Text = ""
For $i = 1 To 100
    $Text &= "Line " & $i & " Line " & $i & " Line " & $i & @CRLF
Next

_MsgBox(104, "Test", $Text)

Func _MsgBox($mb_Icon, $mb_Title, $mb_Text, $mb_Time = 0)
    Local $StrnLenText = MsgLongestString($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
    If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 200
    Local $Button1Txt = "OK"
    Local $Button2Txt = "Cancel"
    Local $MsgValue = 0
    Local $Timer = ''
    Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
    Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 190, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 105, 30 + $NumberOfLines, BitOR(0x00100000, 0x00200000, 0x0800), 0x990)
    GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $Button1 = GUICtrlCreateButton($Button1Txt, 30 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt), 25)
    $Button2 = GUICtrlCreateButton($Button2Txt, 100 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button2Txt), 25)
   
    If $NumberOfLines = (@DesktopHeight - 200) Then
        $ScrollLabel1 = GUICtrlCreateLabel("?", 40, ((100 + $NumberOfLines)/2)+20, 20)
        GUICtrlSetTip(-1, "Click here to scroll Down")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
        $ScrollLabel2 = GUICtrlCreateLabel("?", 40, ((100 + $NumberOfLines)/2)-20, 20)
        GUICtrlSetTip(-1, "Click here to scroll UP")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
    EndIf
   
    GUISetState()
    If $mb_Time <> 0 Then $Timer = TimerInit()
    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $Button1
                $MsgValue = 6
                ExitLoop
            Case $imsg = $Button2
                $MsgValue = 7
                ExitLoop
            Case $imsg = $ScrollLabel1
                ControlSend($iMsgBox, "", $Edit, "{PgDn}")
            Case $imsg = $ScrollLabel2
                ControlSend($iMsgBox, "", $Edit, "{PgUp}")
            Case $mb_Time <> 0
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc

Func MsgLongestString($sText)
    Local $Times = ''
    Local $sSplit = StringSplit($sText, @CRLF)
    If Not @error Then
        ArraySortByLen($sSplit)
        If StringLen($sSplit[1]) <= 100 Then $Times = 2.25
        If StringLen($sSplit[1]) >= 101 And StringLen($sSplit[1]) <= 150 Then $Times = 2.5
        If StringLen($sSplit[1]) >= 151 And StringLen($sSplit[1]) <= 201 Then $Times = 3
        If StringLen($sSplit[1]) >= 202 Then $Times = 3.25
        Return Round(StringLen($sSplit[1])*$Times)
    Else
        If StringLen($sText) <= 100 Then $Times = 2.25
        If StringLen($sText) >= 101 And StringLen($sText) <= 150 Then $Times = 2.5
        If StringLen($sText) >= 151 And StringLen($sText) <= 201 Then $Times = 3
        If StringLen($sText) >= 202 Then $Times = 3.25
        Return Round(StringLen($sText)*$Times)
    EndIf
EndFunc

Func ArraySortByLen(ByRef $nArray, $Start = 1)
    For $i = $Start To UBound($nArray) - 2
        Local $SE = $i
        For $x = $i To UBound($nArray) - 1
            If StringLen($nArray[$SE]) < StringLen($nArray[$x]) Then $SE = $x
        Next
        Local $HLD = $nArray[$i]
        $nArray[$i] = $nArray[$SE]
        $nArray[$SE] = $HLD
    Next
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Is this what you were trying to do though?

Almoust, thanks, but the scrolls must appear only if they needed...

And also, i think that the function MsgLongestString is to big for the task, if i understand right, it should return the biggest line from all given text, right? but why not to loop it and compare with last biggest lenght? see this example:

$Text = ""
For $i = 1 To 30
    $Text &= "Line " & $i & @CRLF
Next
$Text = StringTrimRight($Text, 1) ;Strip the last @CRLF

_MsgBoxScrollable(104, "Test - No Scroll Bars", $Text)

;And now we look how the msgbox expanded with scroll bars (lots of text :D) ...

$Text = ""
For $i = 1 To 150
    $Text &= "Line " & $i & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & ", More text, And some More text" & @CRLF
Next
$Text = StringTrimRight($Text, 1) ;Strip the last @CRLF

_MsgBoxScrollable(104, "Test - With Scroll Bars", $Text)

Func _MsgBoxScrollable($mb_Icon, $mb_Title, $mb_Text, $mb_Time = '')
    Local $StrnLenText = LongestStringLen($mb_Text)
    Local $NumberOfLines = (UBound(StringSplit($mb_Text, @CRLF)) - 1) * 6.5
    If (160 + $NumberOfLines) >= @DesktopHeight Then $NumberOfLines = @DesktopHeight - 200
    If $StrnLenText + 150 >= @DesktopWidth - 200 Then $StrnLenText = @DesktopWidth - 200
    Local $Button1Txt = "OK"
    Local $Button2Txt = "Cancel"
    Local $MsgValue = 0
    Local $Timer = ''
    Local $ScrollLabel1 = -1, $ScrollLabel2 = -1
    Local $iMsgBox = GUICreate($mb_Title, $StrnLenText + 150, 100 + $NumberOfLines, -1, -1, 0x00400000, 0x00000008)
    
    Local $DefaultEditStyle = 0
    If $NumberOfLines >= (@DesktopHeight - 200) Or $StrnLenText + 150 >= 200 Then $DefaultEditStyle = 3150016
    Local $Edit = GUICtrlCreateEdit($mb_Text, 60, 10, $StrnLenText + 80, $NumberOfLines + 30, _
        BitOr($DefaultEditStyle, 64+128+2048+4), 0x990)
    Local $IconID = GUICtrlCreateIcon(@SystemDir & "\User32.dll", $mb_Icon, 10, 10, 35, 35)
    $Button1 = GUICtrlCreateButton($Button1Txt, 10 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button1Txt), 25)
    $Button2 = GUICtrlCreateButton($Button2Txt, 80 + ($StrnLenText / 2), 45 + $NumberOfLines, 60 + StringLen($Button2Txt), 25)
    
    If $NumberOfLines = (@DesktopHeight - 200) Then
        $ScrollLabel1 = GUICtrlCreateLabel("т", 40, ((100 + $NumberOfLines)/2)+20, 20)
        GUICtrlSetTip(-1, "Click here to jump Down")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
        $ScrollLabel2 = GUICtrlCreateLabel("с", 40, ((100 + $NumberOfLines)/2)-20, 20)
        GUICtrlSetTip(-1, "Click here to jump UP")
        GUICtrlSetFont(-1, 18, 600, 0, "Wingdings")
    EndIf
    
    GUISetState()
    If $mb_Time <> 0 Then $Timer = TimerInit()
    ControlFocus($iMsgBox, "", $IconID)
    
    While 1
        $imsg = GUIGetMsg()
        Select
            Case $imsg = $Button1
                $MsgValue = 6
                ExitLoop
            Case $imsg = $Button2
                $MsgValue = 7
                ExitLoop
            Case $imsg = $ScrollLabel1
                ControlSend($iMsgBox, "", $Edit, "{PgDn}")
                ControlFocus($iMsgBox, "", $IconID)
            Case $imsg = $ScrollLabel2
                ControlSend($iMsgBox, "", $Edit, "{PgUp}")
                ControlFocus($iMsgBox, "", $IconID)
            Case $mb_Time <> 0
                If TimerDiff($Timer) / 1000 >= $mb_Time Then ExitLoop
        EndSelect
    WEnd
    GUIDelete($iMsgBox)
    Return $MsgValue
EndFunc

Func LongestStringLen($sText)
    Local $BiggestStr = 0
    Local $sSplit = StringSplit($sText, @CRLF)
    
    For $i = 1 To UBound($sSplit)-1
        If StringLen($sSplit[$i]) > $BiggestStr Then $BiggestStr = StringLen($sSplit[$i])
    Next
    
    Return Round(($BiggestStr*2)+($BiggestStr/4))
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0