Jump to content

Recommended Posts

Posted

I would use simple method:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
;

$hGUI = GUICreate("_GUICtrlSimpleStatusBar_Create Example", 400, 300)

$Input = GUICtrlCreateInput("New StatusBar Text", 50, 50, 200, 20)

$SetStatusData_Button = GUICtrlCreateButton("Set Text", 270, 50, 60, 20)

$StatusBar_Label = _GUICtrlSimpleStatusBar_Create($hGUI, "", 20)
_GUICtrlSimpleStatusBar_SetData($StatusBar_Label, "StatusBar Text", 0x0000FF, 0xFFFFFF, 11, 800, 0, "Georgia")

GUISetState(@SW_SHOW)

While 1
    Switch GUIGetMsg()
        Case $SetStatusData_Button
            _GUICtrlSimpleStatusBar_SetData($StatusBar_Label, GUICtrlRead($Input))
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
Wend

Func _GUICtrlSimpleStatusBar_Create($hWnd_Parent, $sStatus_Text, $iHeight=16)
    Local $aGUI_Pos = WinGetPos($hWnd_Parent)
    Local $aGUI_ClientSize = WinGetClientSize($hWnd_Parent)
    Local $iCaptionHeight = $aGUI_Pos[3] - $aGUI_ClientSize[1]
    
    Local $nRet_StatusBar_Label = GUICtrlCreateLabel(" " & $sStatus_Text, _
        0, $aGUI_Pos[3]-$iHeight-$iCaptionHeight, $aGUI_Pos[2], $iHeight, $SS_SUNKEN)
    
    Return $nRet_StatusBar_Label
EndFunc

Func _GUICtrlSimpleStatusBar_SetData($nStatus,$sTxt,$nFntClr=-1,$nFntBkClr=-1,$iFntSz=-1,$iFntWeight=-1,$iFntAttr=-1,$sFntName=-1)
    GUICtrlSetData($nStatus, " " & $sTxt)
    GUICtrlSetFont($nStatus, $iFntSz, $iFntWeight, $iFntAttr, $sFntName)
    
    If $nFntClr <> -1 Then GUICtrlSetColor($nStatus, $nFntClr)
    If $nFntBkClr <> -1 Then GUICtrlSetBkColor($nStatus, $nFntBkClr)
    
    Return 1
EndFunc

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

But there is a solution for system statusbar control.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted
  sunsunshine said:

Thank you very much, maybe we can use WINAPI function to solve this problem.

It's used (and it's working) in the example from that link i gave you.

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

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
  • Recently Browsing   0 members

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