Sign in to follow this  
Followers 0
Swift

Status Bar Help

16 posts in this topic

I tried using the one from RAS...but I get tons of errors...so I dont know..any help would be cool..

Share this post


Link to post
Share on other sites



#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo, $MainGUI, $hStatus

_Main()

Func _Main()
    Local $lblExample, $btnRun, $cmbExamples
    
    $MainGUI = GUICreate("StatusBar Create Examples", 384, 194, 193, 115)
    $cmbExamples = GUICtrlCreateCombo("", 192, 32, 153, 125, $CBS_DROPDOWNLIST)
    GUICtrlSetData($cmbExamples, "Example 1|Example 2|Example 3|Example 4|Example 5|Example 6", "Example 1")
    $lblExample = GUICtrlCreateLabel("Select StatusBar Example to run", 24, 32, 156, 17)
    $btnRun = GUICtrlCreateButton("Run Example", 40, 88, 81, 33, 0)
    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                Exit
            Case $btnRun
                GUISetState(@SW_DISABLE, $MainGUI)
                Call(StringStripWS(GUICtrlRead($cmbExamples), 8))
        EndSwitch
    WEnd
EndFunc  ;==>_Main

Func Example1()

    Local $hGUI
    Local $aParts[3] = [75, 150, -1]
    
   ; Create GUI
    $hGUI = GUICreate("(Example 1) StatusBar Create", 400, 300)

   ;===============================================================================
   ; defaults to 1 part, no text
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
   ;===============================================================================
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)

   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    MemoWrite("StatusBar Created with:" & @CRLF & _
            @TAB & "Handle to GUI window" & @CRLF)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

   ; Get border sizes
    MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
    MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
    MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUISetState(@SW_ENABLE, $MainGUI)
    GUIDelete($hGUI)
EndFunc  ;==>Example1

Func Example2()

    Local $hGUI
    Local $aParts[3] = [75, 150, -1]
    
   ; Create GUI
    $hGUI = GUICreate("(Example 2) StatusBar Create", 400, 300)

   ;===============================================================================
   ; sets parts with no text
    $hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts)
   ;===============================================================================

   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    MemoWrite("StatusBar Created with:" & @CRLF & _
            @TAB & "Handle to GUI window" & @CRLF & _
            @TAB & "part width array of 3 elements" & @CRLF)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

   ; Get border sizes
    MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
    MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
    MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUISetState(@SW_ENABLE, $MainGUI)
    GUIDelete($hGUI)
EndFunc  ;==>Example2

Func Example3()

    Local $hGUI
    Local $aText[3] = ["Left Justified", @TAB & "Centered", @TAB & @TAB & "Right Justified"]
    Local $aParts[3] = [100, 175, -1]
    
   ; Create GUI
    $hGUI = GUICreate("(Example 3) StatusBar Create", 400, 300)

   ;===============================================================================
   ;sets parts and text
    $hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts, $aText)
   ;===============================================================================

   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    MemoWrite("StatusBar Created with:" & @CRLF & _
            @TAB & "only Handle," & @CRLF & _
            @TAB & "part width array of 3 elements" & @CRLF & _
            @TAB & "part text array of 3 elements" & @CRLF)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

   ; Get border sizes
    MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
    MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
    MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUISetState(@SW_ENABLE, $MainGUI)
    GUIDelete($hGUI)
EndFunc  ;==>Example3

Func Example4()

    Local $hGUI
    Local $aText[3] = ["Left Justified", @TAB & "Centered", @TAB & @TAB & "Right Justified"]
    
   ; Create GUI
    $hGUI = GUICreate("(Example 4) StatusBar Create", 400, 300)

   ;===============================================================================
   ; will create part widths based on part size passed in
    $hStatus = _GUICtrlStatusBar_Create ($hGUI, 100, $aText)
   ;===============================================================================

   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    MemoWrite("StatusBar Created with:" & @CRLF & _
            @TAB & "only Handle," & @CRLF & _
            @TAB & "part width number" & @CRLF & _
            @TAB & "part text array of 3 elements" & @CRLF)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

   ; Get border sizes
    MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
    MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
    MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUISetState(@SW_ENABLE, $MainGUI)
    GUIDelete($hGUI)
EndFunc  ;==>Example4

Func Example5()

    Local $hGUI
    Local $aText[3] = ["Left Justified", @TAB & "Centered", @TAB & @TAB & "Right Justified"]
    Local $aParts[2] = [100, 175]
    
   ; Create GUI
    $hGUI = GUICreate("(Example 5) StatusBar Create", 400, 300)


   ;===============================================================================
   ; adjusts array to largest array passed in (this time the text array is the largest)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts, $aText)
   ;===============================================================================

   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    MemoWrite("StatusBar Created with:" & @CRLF & _
            @TAB & "only Handle," & @CRLF & _
            @TAB & "part width array of 2 elements" & @CRLF & _
            @TAB & "part text array of 3 elements" & @CRLF)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

   ; Get border sizes
    MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
    MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
    MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUISetState(@SW_ENABLE, $MainGUI)
    GUIDelete($hGUI)
EndFunc  ;==>Example5

Func Example6()

    Local $hGUI
    Local $aText[2] = ["Left Justified", @TAB & "Centered"]
    Local $aParts[3] = [100, 175, -1]
    
   ; Create GUI
    $hGUI = GUICreate("(Example 6) StatusBar Create", 400, 300)

   ;===============================================================================
   ; adjusts array to largest array passed in (this time the part width array)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI, $aParts, $aText)
   ;===============================================================================

   ; Create memo control
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUICtrlSendMsg($iMemo, $EM_SETREADONLY, True, 0)
    GUICtrlSetBkColor($iMemo, 0xFFFFFF)
    MemoWrite("StatusBar Created with:" & @CRLF & _
            @TAB & "only Handle," & @CRLF & _
            @TAB & "part width array of 3 elements" & @CRLF & _
            @TAB & "part text array of 2 elements" & @CRLF)
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

   ; Get border sizes
    MemoWrite("Horizontal border width .: " & _GUICtrlStatusBar_GetBordersHorz ($hStatus))
    MemoWrite("Vertical border width ...: " & _GUICtrlStatusBar_GetBordersVert ($hStatus))
    MemoWrite("Width between rectangles : " & _GUICtrlStatusBar_GetBordersRect ($hStatus))

   ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUISetState(@SW_ENABLE, $MainGUI)
    GUIDelete($hGUI)
EndFunc  ;==>Example6

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc  ;==>MemoWrite

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hStatus
            Switch $iCode
                Case $NM_CLICK ; The user has clicked the left mouse button within the control
                    Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return TRUE; indicate that the mouse click was handled and suppress default processing by the system
;~                Return FALSE;to allow default processing of the click.
                Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control
                    Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return TRUE; indicate that the mouse click was handled and suppress default processing by the system
;~                Return FALSE;to allow default processing of the click.
                Case $NM_RCLICK ; The user has clicked the right mouse button within the control
                    Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return TRUE; indicate that the mouse click was handled and suppress default processing by the system
;~                Return FALSE;to allow default processing of the click.
                Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control
                    Local $tinfo = DllStructCreate($tagNMMOUSE, $ilParam)
                    $hWndFrom = HWnd(DllStructGetData($tinfo, "hWndFrom"))
                    $iIDFrom = DllStructGetData($tinfo, "IDFrom")
                    $iCode = DllStructGetData($tinfo, "Code")
                    _DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode & @LF & _
                            "-->ItemSpec:" & @TAB & DllStructGetData($tinfo, "ItemSpec") & @LF & _
                            "-->ItemData:" & @TAB & DllStructGetData($tinfo, "ItemData") & @LF & _
                            "-->X:" & @TAB & DllStructGetData($tinfo, "X") & @LF & _
                            "-->Y:" & @TAB & DllStructGetData($tinfo, "Y") & @LF & _
                            "-->HitInfo:" & @TAB & DllStructGetData($tinfo, "HitInfo"))
                    Return TRUE; indicate that the mouse click was handled and suppress default processing by the system
;~                Return FALSE;to allow default processing of the click.
                Case $SBN_SIMPLEMODECHANGE ; Simple mode changes 
                    _DebugPrint("$SBN_SIMPLEMODECHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
                            "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
                            "-->Code:" & @TAB & $iCode)
                   ; No return value
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_NOTIFY

Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
            "!===========================================================" & @LF & _
            "+======================================================" & @LF & _
            "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
            "+======================================================" & @LF)
EndFunc  ;==>_DebugPrint

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

i did it like this, not sure if this is what you mean :)

#include <GUIConstants.au3>

; make a window

$Form1 = GUICreate("Progressbar", 320, 810, 185, 110)

; add progressbar

$Progressbar = GUICtrlCreateProgress(10, 10, 250, 16)

; add a go - button

$Buttongo = GUICtrlCreateButton("Go!", 250, 780, 65, 25, 0)

; set window to show

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

; wait for something to happen

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

; start func "go()"

Case $Buttongo

go()

EndSwitch

WEnd

Func go()

while 1

; also the progress % on progress bar

$loop = 0

; progress goes 10, 20 , 30 etc..

For $loop = 0 to 100 Step 10

; update progressbar state

GUICtrlSetData ($progressbar, $loop)

Sleep(400)

Next

WEnd

EndFunc

Edited by wictro

Share this post


Link to post
Share on other sites

i did it like this, not sure if this is what you mean :)

#include <GUIConstants.au3>

$Form1 = GUICreate("Progressbar", 320, 810, 185, 110)

$Progressbar = GUICtrlCreateProgress(10, 10, 250, 16)

$Buttongo = GUICtrlCreateButton("Go!", 250, 780, 65, 25, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Buttongo

go()

EndSwitch

WEnd

Func go()

$loop = 0

For $loop = 0 to 100 Step 10

GUICtrlSetData ($progressbar, $loop)

Sleep(400)

Next

WEnd

EndFunc

That would be a progress barl... :)

Share this post


Link to post
Share on other sites

Very nice...and helpfull...how about creating a status bar progress?

Share this post


Link to post
Share on other sites

I have failed to actually use this..because I dont know how to change the data...GUICtrlSetData() doesnt work...so....I want a example 5...with a button to change data...

Share this post


Link to post
Share on other sites

That would be a progress barl... :)

oops :)

Share this post


Link to post
Share on other sites

like this ?

#include <GUIConstants.au3>

; make a window

$Form1 = GUICreate("Progressbar", 320, 810, 185, 110)

; add progressbar

$Progressbar = GUICtrlCreateProgress(10, 10, 250, 16)

; add a "add 10% - button

$Buttonadd = GUICtrlCreateButton("add 10%", 250, 780, 65, 25, 0)

; set window to show

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

; wait for something to happen

$progress = 0

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

; start func "go()"

Case $Buttonadd

go()

EndSwitch

WEnd

Func go()

$progress = ($progress + 10)

GUICtrlSetData ($progressbar, $progress)

If $progress = 110 Then

$progress = 0

EndIf

EndFunc

Share this post


Link to post
Share on other sites

No.... :) but thanks for helping...the progress bar goes on the Status Menu :)

Share this post


Link to post
Share on other sites

No.... :) but thanks for helping...the progress bar goes on the Status Menu :)

Straight from the help:

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

    Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus
    Local $aParts[4] = [80, 160, 300, -1]
    
    ; Create GUI
    $hGUI = GUICreate("StatusBar Embed Control", 400, 300)

    ;===============================================================================
    ; defaults to 1 part, no text
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    _GUICtrlStatusBar_SetMinHeight ($hStatus, 20)

    ;===============================================================================
    GUISetState()

    ; Initialize parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Part 1")
    _GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

    ; Embed a progress bar
    If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE) ; marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200) ; marquee works on Win XP and above
    EndIf
    
    $input = GUICtrlCreateInput("This is Embeded", 0, 0)
    $hInput = GUICtrlGetHandle($input)
    _GUICtrlStatusBar_EmbedControl ($hStatus, 3, $hInput, 3)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

i only use listwindows for status, as i'm a newb ;P

you guys continue.. :)

Edited by wictro

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thanks Gary...But...How DO I CHANGE THE PART 1 PART 2 THINGS?

GUICtrlSetData() DOESNT WORK!

Yay...EDIT: I found out how..thanks everyone!

Edited by Swift

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Why Doesnt This Work? It Deletes The StatusBar After Loading :)

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus, $cng, $nMsg, $menu, $FileMenu, $it
    Local $aParts[4] = [80, 160, 300, -1]
   ; Create GUI
   ;===============================================================================
   ; defaults to 1 part, no text
    $hGUI = GUICreate("StatusBar Embed Control", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create ($hGUI)
    _GUICtrlStatusBar_SetMinHeight ($hStatus, 20)

   ;===============================================================================
    GUISetState()

   ; Initialize parts
    _GUICtrlStatusBar_SetParts ($hStatus, $aParts)
    _GUICtrlStatusBar_SetText ($hStatus, "Loading...")
If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf
    
    Sleep(3000)
    $FileMenu = GUICtrlCreateMenu("Database")
    $it = GUICtrlCreateMenuItem("&Open Database", $FileMenu)
        $cng = GUICtrlCreateButton("test", 1, 1)
    _GUICtrlStatusBar_SetText ($hStatus, "Ready.")
    _GUICtrlStatusBar_SetText ($hStatus, "", 1)
    _GUICtrlStatusBar_SetText ($hStatus, "", 2)

   ; Loop until user exits
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cng
            _GUICtrlStatusBar_SetText ($hSTatus, "tester")
                _GUICtrlStatusBar_SetText ($hStatus, "Test!", 1)
    _GUICtrlStatusBar_SetText ($hStatus, "Testing", 2)
        Case $it
            _GUICtrlStatusBar_SetText ($hSTatus, "Loading Database...")
            Sleep(2500)
            _GUICtrlStatusBar_SetText ($hSTatus, "Ready")
            New()
    EndSwitch
WEnd
EndFunc  ;==>_Main


Func new()
    Local $nMsg, $hSTatus
    GUIcreate("Database")
    GUISetState()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            
    EndSwitch
WEnd
EndFunc
Edited by Swift

Share this post


Link to post
Share on other sites

Just move the menu up above the embed controls part like:

Sleep(3000)
    $FileMenu = GUICtrlCreateMenu("Database")
    $it = GUICtrlCreateMenuItem("&Open Database", $FileMenu)
    $cng = GUICtrlCreateButton("test", 1, 1)
    _GUICtrlStatusBar_SetText($hStatus, "Ready.")
    _GUICtrlStatusBar_SetText($hStatus, "", 1)
    _GUICtrlStatusBar_SetText($hStatus, "", 2)

    ; Initialize parts
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Loading...")
    If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

But i want the menu to be loaded after it Sleeps..not before...I want it to 'load' then create them :) is that possible?

Share this post


Link to post
Share on other sites

#include <GuiConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

Opt('MustDeclareVars', 1)

$Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
    Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus, $cng, $nMsg, $menu, $FileMenu, $it
    Local $aParts[4] = [80, 160, 300, -1]
    ; Create GUI
    ;===============================================================================
    ; defaults to 1 part, no text
    $hGUI = GUICreate("StatusBar Embed Control", 400, 300)
    $hStatus = _GUICtrlStatusBar_Create($hGUI)
    _GUICtrlStatusBar_SetMinHeight($hStatus, 20)

    ;===============================================================================
    GUISetState()

    ; Initialize parts
    _GUICtrlStatusBar_SetParts($hStatus, $aParts)
    _GUICtrlStatusBar_SetText($hStatus, "Loading...")
    If @OSTYPE = "WIN32_WINDOWS" Then
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
    Else
        $progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE); marquee works on Win XP and above
        $hProgress = GUICtrlGetHandle($progress)
        _GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
        _SendMessage($hProgress, $PBM_SETMARQUEE, True, 200); marquee works on Win XP and above
    EndIf

    Sleep(3000)
    $FileMenu = GUICtrlCreateMenu("Database")
    $it = GUICtrlCreateMenuItem("&Open Database", $FileMenu)
    $cng = GUICtrlCreateButton("test", 1, 1)
    _GUICtrlStatusBar_Resize($hStatus) ; force the status bar to repaint after menu is added, menu changes the client area
    _GUICtrlStatusBar_SetText($hStatus, "Ready.")
    _GUICtrlStatusBar_SetText($hStatus, "", 1)
    _GUICtrlStatusBar_SetText($hStatus, "", 2)

    ; Loop until user exits
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $cng
                _GUICtrlStatusBar_SetText($hStatus, "tester")
                _GUICtrlStatusBar_SetText($hStatus, "Test!", 1)
                _GUICtrlStatusBar_SetText($hStatus, "Testing", 2)
            Case $it
                _GUICtrlStatusBar_SetText($hStatus, "Loading Database...")
                Sleep(2500)
                _GUICtrlStatusBar_SetText($hStatus, "Ready")
                new()
        EndSwitch
    WEnd
EndFunc   ;==>_Main


Func new()
    Local $nMsg, $hStatus
    GUICreate("Database")
    GUISetState()
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit

        EndSwitch
    WEnd
EndFunc   ;==>new


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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