Jump to content

Statusbar not covering other controls.


Recommended Posts

Hello there.

I have been trying to add a status bar to one of my resizeable GUI's, but I ran into a problem: The status bar is being created with the GUI, but the controls in the GUI are being created and deleted when needed.

Because using the script will quite often delete and create controls I can't easy make the status bar the last created control, which is the only way I managed the get the behaviour I am trying to achieve.

I've made a small example script that clarifies my problem:

#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
$hWnd = GUICreate("This isn't working!", 400, 400, Default, Default, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_CLIPCHILDREN))

$Statusbar = _GUICtrlStatusBar_Create($hWnd)
_GUICtrlStatusBar_SetText($Statusbar, "This should hide the label when resized")

GUICtrlCreateLabel("This should go behind the statusbar when the window is resized", 55, 200)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($Statusbar)
EndFunc

I hoped to find a "$GUI_TOPMOST" state for GUICtrlSetState(), or something of that nature, but so far with no luck. Any pointers would be greatly appreciated.

Link to comment
Share on other sites

Hello there.

I have been trying to add a status bar to one of my resizeable GUI's, but I ran into a problem: The status bar is being created with the GUI, but the controls in the GUI are being created and deleted when needed.

Because using the script will quite often delete and create controls I can't easy make the status bar the last created control, which is the only way I managed the get the behaviour I am trying to achieve.

I've made a small example script that clarifies my problem:

#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
$hWnd = GUICreate("This isn't working!", 400, 400, Default, Default, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_CLIPCHILDREN))

$Statusbar = _GUICtrlStatusBar_Create($hWnd)
_GUICtrlStatusBar_SetText($Statusbar, "This should hide the label when resized")

GUICtrlCreateLabel("This should go behind the statusbar when the window is resized", 55, 200)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($Statusbar)
EndFunc

I hoped to find a "$GUI_TOPMOST" state for GUICtrlSetState(), or something of that nature, but so far with no luck. Any pointers would be greatly appreciated.

This is one way

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

$hWnd = GUICreate("This isn't working!", 400, 400, Default, Default, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_CLIPCHILDREN))
GUISetState()
$Statusbar = _GUICtrlStatusBar_Create($hWnd)

_GUICtrlStatusBar_SetText($Statusbar, "This should hide the label when resized")
$ch = GUICreate("",400,370,0,0,$WS_CHILD,-1,$hWnd)
$lab = GUICtrlCreateLabel("This should go behind the statusbar when the window is resized", 55, 200)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($Statusbar)

EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks Marting, you've earned a cookie.

That's exactly the behavior I'm looking for, although it's gonna be more work to implement then what I as hoping for, so I'm still open for suggestions.

Link to comment
Share on other sites

Here is the way for avoiding resizing under min height,

So this way overlapping will not occur.

#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
$hWnd = GUICreate("This isn't working!", 400, 400, Default, Default, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_CLIPCHILDREN))

$Statusbar = _GUICtrlStatusBar_Create($hWnd)
_GUICtrlStatusBar_SetText($Statusbar, "This should hide the label when resized")

GUICtrlCreateLabel("This should go behind the statusbar when the window is resized", 55, 200)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_GETMINMAXINFO, "MY_WM_GETMINMAXINFO")
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($Statusbar)
EndFunc

Func MY_WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
 $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam)
 DllStructSetData($minmaxinfo,8,270) ; min Y
 Return 0
EndFunc
Link to comment
Share on other sites

Here is the way for avoiding resizing under min height,

So this way overlapping will not occur.

#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
$hWnd = GUICreate("This isn't working!", 400, 400, Default, Default, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_CLIPCHILDREN))

$Statusbar = _GUICtrlStatusBar_Create($hWnd)
_GUICtrlStatusBar_SetText($Statusbar, "This should hide the label when resized")

GUICtrlCreateLabel("This should go behind the statusbar when the window is resized", 55, 200)
GUICtrlSetResizing(-1, $GUI_DOCKALL)

GUIRegisterMsg($WM_SIZE, "WM_SIZE")
GUIRegisterMsg($WM_GETMINMAXINFO, "MY_WM_GETMINMAXINFO")
GUISetState()

While GUIGetMsg() <> -3
WEnd

Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
    _GUICtrlStatusBar_Resize($Statusbar)
EndFunc

Func MY_WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
 $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam)
 DllStructSetData($minmaxinfo,8,270) ; min Y
 Return 0
EndFunc
Thanks. I'll have a look at that aswell, but I suppose that wouldn't work when using a scrollbar right?
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...