Modify

Opened 5 years ago

Closed 4 years ago

#3830 closed Bug (Fixed)

GUICtrlSetResizing and fullscreen mode

Reported by: kAnon Owned by: Jon
Milestone: 3.3.15.5 Component: AutoIt
Version: 3.3.14.5 Severity: None
Keywords: Cc:

Description

$GUI_DOCKBOTTOM doesn't work correctly when switching fullscreen mode.

#include <GUIConstants.au3>

test()

Func test()
    GUICreate('', 400, 400, -1, -1, -1, $WS_EX_WINDOWEDGE)
    Local $idButton_Fullscreen = GUICtrlCreateButton("Fullscreen", 20, 340, 360, 40)
    GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKHCENTER, $GUI_DOCKSIZE))
    GUISetState()

    While True
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton_Fullscreen
                fullscreen()
        EndSwitch
    WEnd
EndFunc   ;==>test

Func fullscreen()
    Local $aStyles = GUIGetStyle()
    If BitAND($aStyles[0], $WS_CAPTION) Then
        GUISetStyle($WS_POPUP, 0)
        GUISetState(@SW_MAXIMIZE)
    Else
        GUISetState(@SW_RESTORE)
        GUISetStyle($GUI_SS_DEFAULT_GUI, $WS_EX_WINDOWEDGE)
    EndIf
EndFunc   ;==>fullscreen

Windows 10 Pro 21H1 x64
AutoIt Version: 3.3.14.5 / 3.3.15.4

Attachments (0)

Change History (6)

comment:2 by J-Paul Mesnage, 5 years ago

Owner: set to J-Paul Mesnage
Status: newassigned

In fact if you use Maximised stated it works
Any I did a small improvement for your test not using Extendedstyle = 0 which does not make sense to me.

I sent the fix to Jon

#include <AutoItConstants.au3>
#include <GUIConstants.au3>

Global $g_hGui
test()

Func test()
	$g_hGui = GUICreate('', 400, 400, -1, -1, $WS_OVERLAPPEDWINDOW)
    Local $idButton_maximize = GUICtrlCreateButton("toggle maximize", 20, 280, 360, 40)
    GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKHCENTER, $GUI_DOCKSIZE))
    Local $idButton_fullscreen = GUICtrlCreateButton("toggle fullscreen", 20, 340, 360, 40)
    GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKHCENTER, $GUI_DOCKSIZE))
    GUISetState()

    While True
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton_fullscreen
                fullscreen()
            Case $idButton_maximize
                toggle_maximize()
        EndSwitch
    WEnd
EndFunc   ;==>test

Func fullscreen()
    Local $aStyles = GUIGetStyle()
    If BitAND($aStyles[0], $WS_CAPTION) Then
        GUISetStyle($WS_POPUP)
        GUISetState(@SW_MAXIMIZE)
    Else
        GUISetState(@SW_RESTORE)
        GUISetStyle($WS_OVERLAPPEDWINDOW)
    EndIf
EndFunc   ;==>fullscreen

Func toggle_maximize()
		If BitAND(WinGetState($g_hGui, ""), $WIN_STATE_MAXIMIZED) Then
			GUISetState(@SW_RESTORE)
		Else
			GUISetState(@SW_MAXIMIZE)
		EndIf
EndFunc   ;==>toggle_maximize

comment:3 by kAnon, 5 years ago

I don’t know English and almost don’t understand you (even with Google Translate), but with the extended style in full screen mode, the client area is calculated incorrectly

#include <AutoItConstants.au3>
#include <GUIConstants.au3>

Global $g_hGui
test()

Func test()
        $g_hGui = GUICreate('', 400, 400, -1, -1, $WS_OVERLAPPEDWINDOW)
        Local $idButton_maximize = GUICtrlCreateButton("toggle maximize", 20, 280, 360, 40)
        GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKHCENTER, $GUI_DOCKSIZE))
        Local $idButton_fullscreen = GUICtrlCreateButton("toggle fullscreen", 20, 360, 360, 40)
        GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKHCENTER, $GUI_DOCKSIZE))
        GUISetState()

        While True
                Switch GUIGetMsg()
                        Case $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $idButton_fullscreen
                                fullscreen()
                        Case $idButton_maximize
                                toggle_maximize()
                EndSwitch
        WEnd
EndFunc   ;==>test

Func fullscreen()
        Local $aStyles = GUIGetStyle()
        If BitAND($aStyles[0], $WS_CAPTION) Then
                GUISetStyle($WS_POPUP)
                GUISetState(@SW_MAXIMIZE)
        Else
                GUISetState(@SW_RESTORE)
                GUISetStyle($WS_OVERLAPPEDWINDOW)
        EndIf
EndFunc   ;==>fullscreen

Func toggle_maximize()
        If BitAND(WinGetState($g_hGui, ""), $WIN_STATE_MAXIMIZED) Then
                GUISetState(@SW_RESTORE)
        Else
                GUISetState(@SW_MAXIMIZE)
        EndIf
EndFunc   ;==>toggle_maximize

comment:5 by kAnon, 5 years ago

still strange behavior

#include <GUIConstants.au3>

test()

Func test()
    GUICreate('', 400, 400, -1, -1, $WS_OVERLAPPEDWINDOW)
    Local $idButton_ToggleFrame = GUICtrlCreateButton('Toggle Frame', 20, 360, 360, 40)
    GUICtrlSetResizing(-1, BitOR($GUI_DOCKBOTTOM, $GUI_DOCKHCENTER, $GUI_DOCKSIZE))
    GUISetState()

    While True
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idButton_ToggleFrame
                toggleFrame()
        EndSwitch
    WEnd
EndFunc   ;==>test

Func toggleFrame()
    Local $aStyle = GUIGetStyle()
    If BitAND($aStyle[1], $WS_EX_WINDOWEDGE) Then
;~      GUISetStyle($WS_POPUPWINDOW, 0) ; not responding
        GUISetStyle($WS_POPUP) ;  work
    Else
        GUISetStyle($GUI_SS_DEFAULT_GUI, $WS_EX_WINDOWEDGE)
    EndIf
EndFunc   ;==>toggleFrame

comment:6 by Jon, 4 years ago

Milestone: 3.3.15.5
Owner: changed from J-Paul Mesnage to Jon
Resolution: Fixed
Status: assignedclosed

Fixed by revision [12630] in version: 3.3.15.5

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.