Modify

Opened 16 years ago

Closed 16 years ago

#308 closed Bug (No Bug)

Controls embedded in statusbar lose theire position if GUI is minimised and then restored.

Reported by: Bowmore Owned by: Gary
Milestone: Component: Standard UDFs
Version: 3.2.12.0 Severity: None
Keywords: Cc:

Description

GuiStatusBar UDF Bug
OS WinXP SP2
AutoIt 3.2.12.0

Progress bars and possibly other controls loose their possition if the GUI is minimised and then restored. They all move to the bottom left of the GUI. Additionally this somtimes causes AutoIt to crash. The Script below taken direct from the help page for _GUICtrlStatusBar_EmbedControl replicactes the problem,

To Replicate
Run the script
minimise to taskbar
click taskbar to restore

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

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()

	Local $hGUI, $hProgress, $hInput, $input, $progress, $hStatus
	Local $aParts[4] = [80, 160, 300, -1]
	
	; Create GUI
	$hGUI = GUICreate("StatusBar Embed Control", 400, 300)

	;===============================================================================
	; defaults to 1 part, no text
	$hStatus = _GUICtrlStatusBar_Create ($hGUI)
	_GUICtrlStatusBar_SetMinHeight ($hStatus, 20)

	;===============================================================================
	GUISetState()

	; Initialize parts
	_GUICtrlStatusBar_SetParts ($hStatus, $aParts)
	_GUICtrlStatusBar_SetText ($hStatus, "Part 1")
	_GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1)

	; Embed a progress bar
	If @OSTYPE = "WIN32_WINDOWS" Then
		$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
		$hProgress = GUICtrlGetHandle($progress)
		_GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
	Else
		$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE) ; marquee works on Win XP and above
		$hProgress = GUICtrlGetHandle($progress)
		_GUICtrlStatusBar_EmbedControl ($hStatus, 2, $hProgress)
		_SendMessage($hProgress, $PBM_SETMARQUEE, True, 200) ; marquee works on Win XP and above
	EndIf
	
	$input = GUICtrlCreateInput("This is Embeded", 0, 0)
	$hInput = GUICtrlGetHandle($input)
	_GUICtrlStatusBar_EmbedControl ($hStatus, 3, $hInput, 3)

	; Loop until user exits
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
	GUIDelete()
EndFunc   ;==>_Main

Attachments (0)

Change History (1)

comment:1 Changed 16 years ago by Gary

  • Resolution set to No Bug
  • Status changed from new to closed

Being the statusbar is not built-in and the controls embedded are you'll have to make sure the statusbar gets updated when the gui re-paints.

For example:

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

Opt('MustDeclareVars', 1)

$Debug_SB = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Global $hStatus

_Main()

Func _Main()

	Local $hGUI, $hProgress, $hInput, $input, $progress
	Local $aParts[4] = [80, 160, 300, -1]
	
	; Create GUI
	$hGUI = GUICreate("StatusBar Embed Control", 400, 300)

	;===============================================================================
	; defaults to 1 part, no text
	$hStatus = _GUICtrlStatusBar_Create($hGUI)
	_GUICtrlStatusBar_SetMinHeight($hStatus, 20)

	;===============================================================================
	GUISetState()

	; Initialize parts
	_GUICtrlStatusBar_SetParts($hStatus, $aParts)
	_GUICtrlStatusBar_SetText($hStatus, "Part 1")
	_GUICtrlStatusBar_SetText($hStatus, "Part 2", 1)

	; Embed a progress bar
	If @OSTYPE = "WIN32_WINDOWS" Then
		$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_SMOOTH)
		$hProgress = GUICtrlGetHandle($progress)
		_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
	Else
		$progress = GUICtrlCreateProgress(0, 0, -1, -1, $PBS_MARQUEE) ; marquee works on Win XP and above
		$hProgress = GUICtrlGetHandle($progress)
		_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
		_SendMessage($hProgress, $PBM_SETMARQUEE, True, 200) ; marquee works on Win XP and above
	EndIf
	
	$input = GUICtrlCreateInput("This is Embeded", 0, 0)
	$hInput = GUICtrlGetHandle($input)
	_GUICtrlStatusBar_EmbedControl($hStatus, 3, $hInput, 3)

	; Loop until user exits
	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				ExitLoop
			Case $GUI_EVENT_RESTORE
				_GUICtrlStatusBar_EmbedControl($hStatus, 2, $hProgress)
				_GUICtrlStatusBar_EmbedControl($hStatus, 3, $hInput, 3)
		EndSwitch
	WEnd
	GUIDelete()
EndFunc   ;==>_Main

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Gary.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.