Jump to content

Old style drag window


Achilles
 Share

Recommended Posts

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]
Link to comment
Share on other sites

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.
Link to comment
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
Link to comment
Share on other sites

  • 7 months later...
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...