Sign in to follow this  
Followers 0
Achilles

Old style drag window

5 posts in this topic

#1 ·  Posted (edited)

Due to resizing problems and flickering problems with listviews I have decided to try use the old style window drag. By this I mean that when you start dragging instead of the window moving all there is is a frame for where you window will be when you stop dragging.

I have tried most of the normal and extended GUI styles with not luck.

If you don't know what I'm talking about ask and I'll try to explain more.

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

GUICreate("My GUI", 500, 500, -1, -1, $WS_SIZEBOX, $WS_EX_WINDOWEDGE ) ; will create a dialog box that when displayed is centered
GUISetState(@SW_SHOW) ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()

    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
Edited by Achilles

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Due to resizing problems and flickering problems with listviews I have decided to try use the old style window drag. By this I mean that when you start dragging instead of the window moving all there is is a frame for where you window will be when you stop dragging.

The way the window is displayed while dragging is set by a desktop property. Desktop Properties| Appearance|Effects|Show Windows Contents while dragging. (At least in XP)

You could write some code to do a similar thing. You could have a child popup window in your main gui, and place all the controls on the child. When you resize the main window the child stays the same size and so, I suppose, no flicker. On EXITSIZEMOVE set the child size the to the main window client size and poof!, it's done. Well I'm guessing, but it sounds believable to me.

Or maybe there is some way to use WM_SIZE and validate the window so that it isn't redrawn while resizing.

Can you give an example of a gui which shows the problem you have?

Edited by martin

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.

Share this post


Link to post
Share on other sites

This working example of the script copied from here by Siao may help.

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

Opt("GUIOnEventMode", 1)

;~ Global Const $WM_ENTERSIZEMOVE = 0x231
Global Const $WM_EXITSIZEMOVE = 0x232
;~ Global Const $WM_SETREDRAW = 0x000B

;Const $WM_SYSCOMMAND = 0x0112
Const $SC_MOVE = 0xF010
Const $SC_SIZE = 0xF000

Global $OldParam

$parent = GUICreate("GUI", 200, 400, -1, -1, $WS_SIZEBOX)
;~ GUIRegisterMsg($WM_ENTERSIZEMOVE, "WM_ENTERSIZEMOVE")
GUIRegisterMsg($WM_EXITSIZEMOVE, "WM_EXITSIZEMOVE")
GUIRegisterMsg($WM_SYSCOMMAND, "On_WM_SYSCOMMAND")

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

$Button = GUICtrlCreateButton("Button", 50, 100, 100, 21)

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func On_WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam)
    Switch BitAND($wParam, 0xFFF0)
        Case $SC_MOVE, $SC_SIZE
            ;Const $SPI_SETDRAGFULLWINDOWS = 37
            ;Const $SPI_GETDRAGFULLWINDOWS = 38
            ;Const SPIF_SENDWININICHANGE = 2
            $tBool = DllStructCreate("int")
            DllCall("user32.dll", "int", "SystemParametersInfo", "int", 38, "int", 0, "ptr", DllStructGetPtr($tBool), "int", 0)
            $OldParam = DllStructGetData($tBool, 1)
            DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", 0, "ptr", 0, "int", 2)
    EndSwitch
EndFunc ;==>On_WM_SYSCOMMAND

Func WM_EXITSIZEMOVE()
    DllCall("user32.dll", "int", "SystemParametersInfo", "int", 37, "int", $OldParam, "ptr", 0, "int", 2)
EndFunc ;==>WM_EXITSIZEMOVE

Func _Exit()
    Exit
EndFunc ;==>_Exit

Share this post


Link to post
Share on other sites

Siaos code proves it's awesomeness again and again :mellow:, just what I was looking for to avoid the flicker on resizing SMFs report GUI! Sad he seems not to be around anymore...

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