Jump to content

_GuiCtrlStatusBar


Recommended Posts

Is it in someway possible to create a StatusBar with _GuiCtrlStatusBarCreate and hide it in you program and show it again in some other part of your program ?

If yes how can we do that ?

Not sure what exactly you mean, but why not just create a status bar on the other part of your program?

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

Now i use a smal window as a statusbar and with GUICtrlSetState($guiStatus1,$GUI_HIDE) i hide them

Is this also possible for the _GuiCtrlStatusBar ?

Far as I know, no.

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

  • Moderators

Might be able to just use ControlHide() :whistle:

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.

Link to comment
Share on other sites

  • Moderators

Good luck, I believe the status bar hooks into the gui, try hiding it using controlhide and see what happens.

Thus the "might"...

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.

Link to comment
Share on other sites

Thus the "might"...

It can be destroyed (deleted) and a new one created i.e.

opt("MustDeclareVars", 1)
Opt('WinTitleMatchMode', 4)

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

Local $gui, $StatusBar1, $msg
Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = ["New Text", "More Text", "Even More Text"]

$gui = GUICreate("Status Bar Create", 500, -1, -1, -1, $WS_SIZEBOX)
ConsoleWrite(HWnd($gui) & @LF)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
GUISetState(@SW_SHOW)
Sleep ( 3000 )
DllCall("user32.dll","int","DestroyWindow","hwnd",HWnd($StatusBar1))
While 1
    $msg = GUIGetMsg()
    Select
;~      Case $msg = $GUI_EVENT_RESIZED
;~          _GUICtrlStatusBarResize ($StatusBar1)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case Else
            ;;;;;
    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

can also hide it and show it might add a few more functions to the udf

Sleep ( 3000 )
DllCall("user32.dll","int","ShowWindow","hwnd",HWnd($StatusBar1),"int",@SW_HIDE)
Sleep ( 3000 )
DllCall("user32.dll","int","ShowWindow","hwnd",HWnd($StatusBar1),"int",@SW_SHOW)

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

  • Moderators

can also hide it and show it might add a few more functions to the udf

Sleep ( 3000 )
DllCall("user32.dll","int","ShowWindow","hwnd",HWnd($StatusBar1),"int",@SW_HIDE)
Sleep ( 3000 )
DllCall("user32.dll","int","ShowWindow","hwnd",HWnd($StatusBar1),"int",@SW_SHOW)
I like that one :whistle: ... well I like the destroy window too, but for the cause of this thread...

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.

Link to comment
Share on other sites

  • 4 weeks later...

how does one get the text in the statusbar to be centered? I've tried using the $SS_CENTER and doesn't seem to work.

You would have to create an owner-drawn statusbar, this one is not owner-drawn.

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

You would have to create an owner-drawn statusbar, this one is not owner-drawn.

Hmm ok, I'll see what I can do otherwise.

On another note, how about a progress bar in the status bar? I tried to do something like this where the partsrightedge would increase and then the background of the bar color would redraw but can't get the color to take.

#include <GuiStatusBar.au3>
#include <guiconstants.au3>
Dim $a_PartsRightEdge = 0
Dim $a_PartsText = ""

$count = 1
$sbp = GUICreate("Status Progress Bar",200,200,-1,-1)
;GUICtrlSetResizing(-1,$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$StatusBar1 = _GuiCtrlStatusBarCreate($sbp, $a_PartsRightEdge, $a_PartsText, $SBT_TOOLTIPS)
_GuiCtrlStatusBarSetMinHeight($StatusBar1, 10)
_GUICtrlStatusBarSetBKColor($statusbar1,0x0ff0000)
GUICtrlSetBkColor($statusbar1,0x0ff0000)
GUISetState()
For $x = 1 To 200 Step 1
    $StatusBar1 = _GuiCtrlStatusBarCreate($sbp, $x, $a_PartsText, $SBT_TOOLTIPS)
    _GUICtrlStatusBarResize($StatusBar1)
    _GUICtrlStatusBarSetBKColor($statusbar1,0x001421)
    Sleep(200)
Next
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd
Edited by powaking
Link to comment
Share on other sites

don't have time to look at it, it's Friday and time for me to go, but here's a link for you too look at

http://www.autoitscript.com/forum/index.ph...st&p=140771

BTW the Search feature of the forum works for everyone.

Edited by gafrost

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

@gafrost

Thnx for making it possible to hide the statusbar when needed

Another question : is it possibel to put text on 2 lines instead of 1 line ?

Far as I can tell nope.

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

You would have to create an owner-drawn statusbar, this one is not owner-drawn.

Owner draw is not needed. :)

It's very simple:

By default, text is left-aligned within the specified part of a status bar.

You can embed tab characters (\ t) in the text to center or right-align it.

Text to the right of a single tab character is centered,

and text to the right of a second tab character is right-aligned.

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

Local $a_PartsRightEdge[3] = [100, 350, -1]
Local $a_PartsText[3] = [@TAB & @TAB & "New Text", "Left" & @TAB & "Center" & @TAB & "Right", "Even More Text"]

$gui = GUICreate("Status Bar Create", 500, -1, -1, -1, $WS_SIZEBOX)
$StatusBar1 = _GUICtrlStatusBarCreate ($gui, $a_PartsRightEdge, $a_PartsText)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Select
  Case $msg = $GUI_EVENT_RESIZED
   _GUICtrlStatusBarResize ($StatusBar1)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
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...