Jump to content
Sign in to follow this  

_GuiCtrlCreate_StatusBar has me stumped...

Recommended Posts

i am trying to create a statusbar for my gui but reading the help file im not getting anywhere...

$Label1 = GUICtrlCreateLabel("11203 of 50000 results", 0, 152, 132, 17)
;GUICtrlSetBkColor(-1, 0xF0F0F0)
$Label2 = GUICtrlCreateLabel("abcdefghijk", 136, 152, 604, 25)
;GUICtrlSetBkColor(-1, 0xF0F0F0)
$Progress1 = GUICtrlCreateProgress(744, 152, 150, 25)
;$Progress1 = GUICtrlCreateProgress(16, 152, 750, 33)
local $Aparts[3] = [126,127,128]
$hstatus = _GUICtrlStatusBar_Create($Form1,$aparts)
;_GuiCtrlStatusbar_SetParts ($hstatus,1,132)
_GUICtrlStatusBar_EmbedControl ($hStatus, 1, $Progress1)
_GUICtrlStatusBar_EmbedControl ($hStatus, 2, $Label1)
_GUICtrlStatusBar_EmbedControl ($hStatus, 3, $Label2)

im trying to have 1 progress bar and 2 text labels inside of my statusbar!

Share this post

Link to post
Share on other sites


The forum "Search" facility is at top right - might be a good idea to use it now and again. :(

Then you could easily find out how to do what you want: :graduated:

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

; Set right edges of status parts
Local $aParts[3] = [150, 300, -1]

; Create GUI
$hGUI = GUICreate("StatusBar Embed Control", 500, 300)

; Create statusbar
$hStatus = _GUICtrlStatusBar_Create($hGUI)
_GUICtrlStatusBar_SetMinHeight($hStatus, 20)
_GUICtrlStatusBar_SetParts($hStatus, $aParts)


; Set text in first 2 parts
_GUICtrlStatusBar_SetText($hStatus, "11203 of 50000 results")
_GUICtrlStatusBar_SetText($hStatus, "abcdefghijk", 1)

; Embed a progress bar in third part
$hProgress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
$hProgress_Handle = GUICtrlGetHandle($hProgress)
_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress_Handle)

; For progress advance
$iProg_Set = 0
$iBegin = TimerInit()

; Loop until user exits
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE

    ; Make progress advance
    If TimerDiff($iBegin) > 50 Then
        $iProg_Set = Mod($iProg_Set + 1, 100)
        GUICtrlSetData($hProgress, $iProg_Set + 1)
        GUICtrlSetData($hProgress, $iProg_Set)
        $iBegin = TimerInit()


You will find that the progress does not reappear if you minimize and restore the GUI - but I will let you find out how to solve that (hint: searching for "+embedded +statusbar" will give you the answer fairly quickly)! :D


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:


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


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...