Sign in to follow this  
Followers 0
jercfd

status bar controls disappearing

5 posts in this topic

#1 ·  Posted (edited)

When I resize my GUI, the controls disapear/resize to cover the status bar.

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 401, 201, 440, 224, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))
$hStatusBar = _GUICtrlStatusBar_Create($Form1)
Dim $StatusBar1_PartsWidth[3] = [100, 200, 250]
_GUICtrlStatusBar_SetParts($hStatusBar, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
$progress = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl ($hStatusBar, 1, $hProgress)
$progress2 = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress2 = GUICtrlGetHandle($progress2)
_GUICtrlStatusBar_EmbedControl ($hStatusBar, 2, $hProgress2)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($hStatusBar)
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_SIZE

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include <IE.au3>
Opt("GUIOnEventMode", 1)
Global $sTitle = "Web Browser"
Global $sVersion = "1.0"
$hGUI = GUICreate($sTitle & " " & $sVersion, 640, 480, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_GUI_Events")
_IEErrorHandlerRegister()
$oIE = ObjCreate("Shell.Explorer.2")
$oIEObj = GUICtrlCreateObj($oIE, 0, 0, 640, 480-25)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
ObjEvent($oIE,"_IE_Event_","DWebBrowserEvents")
_IENavigate($oIE,"http://www.google.com/")
$hStatusBar = _GUICtrlStatusBar_Create($hGUI)
Local $hStatusBar_Parts[2] = [640-150, 100]
_GUICtrlStatusBar_SetParts($hStatusBar, $hStatusBar_Parts)
_GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
$ctprogress = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress = GUICtrlGetHandle($ctprogress)
_GUICtrlStatusBar_EmbedControl ($hStatusBar, 1, $hProgress)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")
GUISetState(@SW_SHOW, $hGUI)
While 1
    If _IEPropertyGet($oIE, "readystate") < 4 Then 
        _GUICtrlStatusBar_SetText($hStatusBar, "Loading: " & _IEPropertyGet($oIE, "locationurl"), 0)
    ElseIf _IEPropertyGet($oIE, "readystate") = 4 Then
        _GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
    EndIf
    WinSetTitle($hGUI, "", _IEPropertyGet($oIE, "title") & " - " & $sTitle & " " & $sVersion)
    Sleep(75)
WEnd
Func _Main_GUI_Events()
    Local $nMsg = @GUI_CtrlId
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _Exit()
    EndSwitch
EndFunc  ;==>_Main_GUI_Events
Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $MINMAXINFO = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    Local $aiWinSize = WinGetPos($hWnd)
    Local $aiClientSize = WinGetClientSize($hWnd)
    DllStructSetData($MINMAXINFO, 7, 395 + ($aiWinSize[2] - $aiClientSize[0]));Minimum X
    DllStructSetData($MINMAXINFO, 8, 300 + ($aiWinSize[3] - $aiClientSize[1]));Minimum Y
;DllStructSetData($MINMAXINFO, 9, 0);Maximum X
;DllStructSetData($MINMAXINFO, 10, 0);Maximum Y
    Return 0
EndFunc  ;==>WM_GETMINMAXINFO
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($hStatusBar)
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_SIZE
Func _Exit()
    Exit
EndFunc  ;==>_Exit
Edited by jercfd

Share this post


Link to post
Share on other sites



does anyone have a idea why?

Share this post


Link to post
Share on other sites

When I resize my GUI, the controls disapear/resize to cover the status bar.

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 401, 201, 440, 224, _
        BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, _ 
        WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, _ 
        $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS))
$hStatusBar = _GUICtrlStatusBar_Create($Form1)
Dim $StatusBar1_PartsWidth[3] = [100, 200, 250]
_GUICtrlStatusBar_SetParts($hStatusBar, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
$progress = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl ($hStatusBar, 1, $hProgress)
$progress2 = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress2 = GUICtrlGetHandle($progress2)
_GUICtrlStatusBar_EmbedControl ($hStatusBar, 2, $hProgress2)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($hStatusBar)
    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiStatusBar.au3>
#include <IE.au3>
Opt("GUIOnEventMode", 1)
Global $sTitle = "Web Browser"
Global $sVersion = "1.0"
$hGUI = GUICreate($sTitle & " " & $sVersion, 640, 480, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, _
        $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, _
        $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, _
        $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Main_GUI_Events")
_IEErrorHandlerRegister()
$oIE = ObjCreate("Shell.Explorer.2")
$oIEObj = GUICtrlCreateObj($oIE, 0, 0, 640, 480-25)
GUICtrlSetResizing(-1, $GUI_DOCKBORDERS)
ObjEvent($oIE,"_IE_Event_","DWebBrowserEvents")
_IENavigate($oIE,"http://www.google.com/")
$hStatusBar = _GUICtrlStatusBar_Create($hGUI)
Local $hStatusBar_Parts[2] = [640-150, 100]
_GUICtrlStatusBar_SetParts($hStatusBar, $hStatusBar_Parts)
_GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
$ctprogress = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress = GUICtrlGetHandle($ctprogress)
_GUICtrlStatusBar_EmbedControl ($hStatusBar, 1, $hProgress)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")
GUISetState(@SW_SHOW, $hGUI)
While 1
    If _IEPropertyGet($oIE, "readystate") < 4 Then 
        _GUICtrlStatusBar_SetText($hStatusBar, "Loading: " & _IEPropertyGet($oIE, "locationurl"), 0)
    ElseIf _IEPropertyGet($oIE, "readystate") = 4 Then
        _GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
    EndIf
    WinSetTitle($hGUI, "", _IEPropertyGet($oIE, "title") & " - " & $sTitle & " " & $sVersion)
    Sleep(75)
WEnd
Func _Main_GUI_Events()
    Local $nMsg = @GUI_CtrlId
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            _Exit()
    EndSwitch
EndFunc ;==>_Main_GUI_Events
Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $MINMAXINFO = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    Local $aiWinSize = WinGetPos($hWnd)
    Local $aiClientSize = WinGetClientSize($hWnd)
    DllStructSetData($MINMAXINFO, 7, 395 + ($aiWinSize[2] - $aiClientSize[0]));Minimum X
    DllStructSetData($MINMAXINFO, 8, 300 + ($aiWinSize[3] - $aiClientSize[1]));Minimum Y
;DllStructSetData($MINMAXINFO, 9, 0);Maximum X
;DllStructSetData($MINMAXINFO, 10, 0);Maximum Y
    Return 0
EndFunc ;==>WM_GETMINMAXINFO
Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($hStatusBar)
    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE
Func _Exit()
    Exit
EndFunc ;==>_Exit
Looks like a bug, though I don't know if it's AutoIt or Windows that has the problem. A similar bug trac report was made, but the disappearing progress bars never got addressed after a more severe crash issue with the marquee type progress bar was discussed.

I opened Trac #735 to see if the disappearing progress bar side of it could be addressed.

Even destroying the status bar a rebuilding it on each re-size doesn't bring the progress bars back:

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Global $Form1, $hStatusBar, $progress, $hProgress, $progress2, $hProgress2
Global $StatusBar1_PartsWidth[3] = [100, 200, 250]

$Form1 = GUICreate("Form1", 401, 201, 440, 224, BitOR($WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP))
_StatusBarUpdate()
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _StatusBarUpdate()
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_SIZE

Func _StatusBarUpdate()
    ConsoleWrite("Debug: Updating statusbar" & @LF)
    GUICtrlDelete($progress)
    GUICtrlDelete($progress2)
    _GUICtrlStatusBar_Destroy($hStatusBar)
    $hStatusBar = _GUICtrlStatusBar_Create($Form1)
    _GUICtrlStatusBar_SetParts($hStatusBar, $StatusBar1_PartsWidth)
    _GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
    $progress = GUICtrlCreateProgress(0, 0, -1, -1)
    $hProgress = GUICtrlGetHandle($progress)
    _GUICtrlStatusBar_EmbedControl($hStatusBar, 1, $hProgress)
    $progress2 = GUICtrlCreateProgress(0, 0, -1, -1)
    $hProgress2 = GUICtrlGetHandle($progress2)
    _GUICtrlStatusBar_EmbedControl($hStatusBar, 2, $hProgress2)
EndFunc  ;==>_StatusBarUpdate

Tested on XP Pro SP3 with 3.2.12.1 and 3.2.13.11.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Global $Form1, $hStatusBar, $progress, $hProgress, $progress2, $hProgress2, $fSize = False
Global $StatusBar1_PartsWidth[3] = [100, 200, 250]

$Form1 = GUICreate("Form1", 401, 201, 440, 224, BitOR($WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP))
$hStatusBar = _GUICtrlStatusBar_Create($Form1)
_GUICtrlStatusBar_SetParts($hStatusBar, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
$progress = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 1, $hProgress)
$progress2 = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress2 = GUICtrlGetHandle($progress2)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 2, $hProgress2)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            If $fSize Then
                $fSize = False
                _GUICtrlStatusBar_EmbedControl($hStatusBar, 1, $hProgress)
                _GUICtrlStatusBar_EmbedControl($hStatusBar, 2, $hProgress2)
            EndIf
    EndSwitch
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    $fSize = True
    _GUICtrlStatusBar_Resize($hStatusBar)
    Return $GUI_RUNDEFMSG
EndFunc  ;==>WM_SIZE


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

#5 ·  Posted (edited)

#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>

Global $Form1, $hStatusBar, $progress, $hProgress, $progress2, $hProgress2, $fSize = False
Global $StatusBar1_PartsWidth[3] = [100, 200, 250]

$Form1 = GUICreate("Form1", 401, 201, 440, 224, BitOR($WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP))
$hStatusBar = _GUICtrlStatusBar_Create($Form1)
_GUICtrlStatusBar_SetParts($hStatusBar, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($hStatusBar, "Ready", 0)
$progress = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress = GUICtrlGetHandle($progress)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 1, $hProgress)
$progress2 = GUICtrlCreateProgress(0, 0, -1, -1)
$hProgress2 = GUICtrlGetHandle($progress2)
_GUICtrlStatusBar_EmbedControl($hStatusBar, 2, $hProgress2)
GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case Else
            If $fSize Then
                $fSize = False
                _GUICtrlStatusBar_EmbedControl($hStatusBar, 1, $hProgress)
                _GUICtrlStatusBar_EmbedControl($hStatusBar, 2, $hProgress2)
            EndIf
    EndSwitch
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    $fSize = True
    _GUICtrlStatusBar_Resize($hStatusBar)
    Return $GUI_RUNDEFMSG
EndFunc;==>WM_SIZE
That works, but I don't understand why this doesn't (it was one of my many attempts):
; ...<snip>

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($hStatusBar)
    _GUICtrlStatusBar_EmbedControl($hStatusBar, 1, $hProgress)
    _GUICtrlStatusBar_EmbedControl($hStatusBar, 2, $hProgress2)
    Return $GUI_RUNDEFMSG
EndFunc ;==>WM_SIZE

What's wrong with re-embedding the control inside the WM_SIZE function?

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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