Jump to content

Status bar problem in custom GUI


Bob Wya
 Share

Recommended Posts

Hi

I have script I have written that needs a status bar with 1/2 GUI width for a file name and the other 1/2 for a progress bar.

The script I am working in on is over 2000 lines long so I just include (hopefully!!) the relevant lines of code.

The problem is that whatever size array of widths and text I supply to the function _GUICtrlStatusBarCreate() I always end up with a single

element status bar (with a progress bar or whatever I put in it) of the right width for the first part.

The status bar did drop of the bottom of the main GUI when I first wrote it into my script but I think this is caused by having a menu at the top of the GUI or something like that.

Calling _GUICtrlStatusBarResize() after creating the full GUI sorted the problem.

Any thoughts why I can't create an multi-part status bar? BTW the example (Help) scripts work fine.

Cheers

Bob Wya

Status_Bar.txt

Link to comment
Share on other sites

Hi

I have basically substituted all kinds of values in the arrays I am passing in. Just straight numerical values... With the values shown then a progress bar defined in part 0 will be have the width of the GUI window (as expected).

However all I get is the first part of the Status bar...

Then a dividing line...

Then the rest of the status bar is the right colour but will be the remaining width of the window and I can't define any Status bar controls in this area!!

Whats wierd is the Status bar creation part of my Script is less complex than the example code in the AutoIt Help!! (Which do work!!)

Bob Wya

Link to comment
Share on other sites

Hi

I have basically substituted all kinds of values in the arrays I am passing in. Just straight numerical values... With the values shown then a progress bar defined in part 0 will be have the width of the GUI window (as expected).

However all I get is the first part of the Status bar...

Then a dividing line...

Then the rest of the status bar is the right colour but will be the remaining width of the window and I can't define any Status bar controls in this area!!

Whats wierd is the Status bar creation part of my Script is less complex than the example code in the AutoIt Help!! (Which do work!!)

Bob Wya

Far as I can tell your wanting to create 2 parts on the statusbar, the 1st part (index 0) has text, 2nd part (index 1) has a status bar

try using -1 for the size on the second part, for example

Opt("MustDeclareVars", 1)

#include <GUIConstants.au3>
#Include <GuiStatusBar.au3>

;~ DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) ; turn off XP themes

Local $gui, $StatusBar1, $msg, $ProgressBar1, $ProgressBar2, $iProgress = 0, $button
Local $global_main_window_width = 500
Local $i, $s, $m, $wait
Local $a_PartsRightEdge[2] = [$global_main_window_width*.5,-1]
Local $a_PartsText[2] = ["some text", ""]
$gui = GUICreate("Status Bar Create", $global_main_window_width, -1, -1, -1, $WS_SIZEBOX)
$button = GUICtrlCreateButton ("Start",75,70,70,20)
$StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText)
$ProgressBar1 = _GUICtrlStatusBarCreateProgress($StatusBar1, 1, $PBS_SMOOTH)
GUICtrlSetColor($ProgressBar1,32250)
GUISetState(@SW_SHOW)

$wait = 20; wait 20ms for next progressstep
$s = 0; progressbar-saveposition

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_RESIZED
            _GUICtrlStatusBarResize($StatusBar1)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            GUICtrlSetData ($button,"Stop")
            For $i = $s To 100

                If GUICtrlRead($ProgressBar1) = 50 Then _GUICtrlStatusBarSetText($StatusBar1,"The half is done...")
                $m = GUIGetMsg ()
    
                If $m = -3 Then ExitLoop
    
                If $m = $button Then
                    GUICtrlSetData ($button,"Next")
                    $s = $i;save the current bar-position to $s
                    ExitLoop
                Else
                    $s=0
                    GUICtrlSetData ($ProgressBar1,$i)
                    Sleep($wait)
                EndIf
            Next
        if $i >100 Then GUICtrlSetData ($button,"Start")

    EndSelect
    
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

Bilo kuda gafrost svuda

:shocked:

*where the heck is strikeout* Whoa, I forgotted I am not on Croatian forum *damn, lets use spoiler...ok, thats better...*

i542

Edited by i542

I can do signature me.

Link to comment
Share on other sites

Hi All,

Yeh sorry for being such a newbie!! I thought I had tried -1 already (to use up remaining width of window) as per the Help examples... DUh! Must have had something else wrong when I tried that!!

Thanks its working now!!

Bob Wya

Link to comment
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
 Share

  • Recently Browsing   0 members

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