Jump to content

Resizing limits + popupu child win position


Recommended Posts

hi forum i got an issue, i need to use two windows one default and one with $WS_POPUP, $WS_THICKFRAME And $WS_EX_MDICHILD style my first problem is how to calculate the points to create the popup windows in the same size of the default window(not only client area size).. and my second problem is ¿how i limit the resizin of that popup stilish window to do not cross over the another window? here is what i got so far...

#include <WindowsConstants.au3>
#include <array.au3>
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1)
GUISetState()
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", 500, 524, 507, -30, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)
GUIRegisterMsg($WM_SIZING, "_My_WM_SIZING")
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
WEnd
Func _My_WM_SIZING($hWnd, $msg, $wParam, $lParam)
    Local $WmainGP = WinGetPos($hGui)
    Local $WlistGP = WinGetPos($hListGui)
    Switch $wParam
        Case "0x0000000000000001" ;izq ; Left
            If $WlistGP[0] < $WmainGP[0] + $WmainGP[2] + 7 Then
                winmove($hListGui,"",$WmainGP[0] + $WmainGP[2] + 7,$WlistGP[1])
;~              $wparam = "0x0000000000000002" ; i already try this and doesn´t work..
            EndIf
        Case "0x0000000000000002" ;der ; Right
            ConsoleWrite("der" & @CRLF)
        Case "0x0000000000000003" ;arr ; Up
            ConsoleWrite("arr" & @CRLF)
        Case "0x0000000000000006" ;aba ; Down
            ConsoleWrite("aba" & @CRLF)
    EndSwitch
EndFunc   ;==>_My_WM_SIZING

EDIT : I see now the Fail of this... $wparam = "0x0000000000000002"... im not sending a msg only recording a function to do when a event ocur :s

Edited by monoscout999
Link to comment
Share on other sites

You mean something like this?

#include <WindowsConstants.au3>
#include <array.au3>
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1)
GUISetState()
$aSize = WinGetClientSize($hGui)
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", $aSize[0], $aSize[1], 508, -7, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)

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

$aPos = WinGetPos($hListGui)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($minmaxinfo, 7, 100) ; min X
    DllStructSetData($minmaxinfo, 8, 100) ; min Y
    DllStructSetData($minmaxinfo, 9, $aPos[2]) ; max X
    DllStructSetData($minmaxinfo, 10, $aPos[3]) ; max Y
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_GETMINMAXINFO

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

@UEZ yes.. something like that... i only want the left side don´t go over the other window... limit that side only.. i´ve reading http://msdn.microsoft.com/en-us/library/ms632605%28v=VS.85%29.aspx and i see the struct needs only 5 points... you use 10 int... 2 int for point... is that correct?

#include <WindowsConstants.au3>
#include <array.au3>
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1)
GUISetState()
$aSize = WinGetClientSize($hGui)
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", $aSize[0], $aSize[1]+23, 508, -30, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)

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

$aPos = WinGetPos($hListGui)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
WEnd

Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam)
    Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam)
    DllStructSetData($minmaxinfo, 7, $aPos[2]) ; min X
    DllStructSetData($minmaxinfo, 8, 100) ; min Y
;~  DllStructSetData($minmaxinfo, 9, $aPos[2]) ; max X
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_GETMINMAXINFO

This is good, but

How can i limt only the left side?

Edited by monoscout999
Link to comment
Share on other sites

I solve the left siding but i have maths problem with the width :S

#include <WindowsConstants.au3>
#include <array.au3>
#include <winapiex.au3>
#include <StructureConstants.au3>
global $checkSizing  = false
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1)
GUISetState()
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", 500, 524, 507, -30, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)
GUIRegisterMsg($WM_SIZING, "_My_WM_SIZING")
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
    while $checkSizing = true
    Local $WmainGP = WinGetPos($hGui)
    Local $WlistGP = WinGetPos($hListGui)
    winmove($hListGui,"",$WmainGP[0] + $WmainGP[2] + 5,$WlistGP[1],$WlistGP[2]-($WlistGP[0]-($WmainGP[0] + $WmainGP[2] + 5)))
    $checkSizing = false
    wend
WEnd
Func _My_WM_SIZING($hWnd, $msg, $wParam, $lParam)
    If $wparam = 1 then $checkSizing = true
EndFunc   ;==>_My_WM_SIZING

also if anyone know how to calculate the real height of a window(Not only the client area) it will be useful for calculate the popup window top side

Link to comment
Share on other sites

I solve the left siding but i have maths problem with the width :S

#include <WindowsConstants.au3>
#include <array.au3>
#include <winapiex.au3>
#include <StructureConstants.au3>
global $checkSizing  = false
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1)
GUISetState()
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", 500, 524, 507, -30, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)
GUIRegisterMsg($WM_SIZING, "_My_WM_SIZING")
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
    while $checkSizing = true
    Local $WmainGP = WinGetPos($hGui)
    Local $WlistGP = WinGetPos($hListGui)
    winmove($hListGui,"",$WmainGP[0] + $WmainGP[2] + 5,$WlistGP[1],$WlistGP[2]-($WlistGP[0]-($WmainGP[0] + $WmainGP[2] + 5)))
    $checkSizing = false
    wend
WEnd
Func _My_WM_SIZING($hWnd, $msg, $wParam, $lParam)
    If $wparam = 1 then $checkSizing = true
EndFunc   ;==>_My_WM_SIZING

also if anyone know how to calculate the real height of a window(Not only the client area) it will be useful for calculate the popup window top side

I am a bit confused by your posts because you talk about th ewindow being resized but the main gui has no WS_SIZEBOX.

I'm making a guess but I think you want something like this.

#include <WindowsConstants.au3>
#include <array.au3>
#include <winapiex.au3>
#include <StructureConstants.au3>
Global $checkSizing = False
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
GUISetState()
$Pos = WinGetPos($hGui)
$border = _WinAPI_GetSystemMetrics(7) * 2; + _WinAPI_GetSystemMetrics(5)
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", $Pos[2] - $border, $Pos[3] - $border, 507, -30, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)
GUIRegisterMsg($WM_SIZING, "_My_WM_SIZING")
GUISetState()
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch

WEnd
Func _My_WM_SIZING($hWnd, $msg, $wParam, $lParam)
    Local $tRECT = DllStructCreate("long; long; long; long", $lParam)
    ; $aTmp = WinGetPos($hGuiMini)
    WinMove($hListGui, "", DllStructGetData($tRECT, 3), DllStructGetData($tRECT, 2), DllStructGetData($tRECT, 3) - DllStructGetData($tRECT, 1), DllStructGetData($tRECT, 4) - DllStructGetData($tRECT, 2))
EndFunc   ;==>_My_WM_SIZING
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

I think you want this or?

#include <WinAPI.au3>
#include <WindowsConstants.au3>
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1)
GUISetState()
$aSize = WinGetClientSize($hGui)
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", $aSize[0], $aSize[1], 508, -7, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)

GUIRegisterMsg($WM_SIZING, "WM_SIZING")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
WEnd

Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
    Local $sRect = DllStructCreate("Int[4]", $lParam)
    Local $left = DllStructGetData($sRect, 1, 1)
    Local $top = DllStructGetData($sRect, 1, 2)
    Local $right = DllStructGetData($sRect, 1, 3)
    Local $bottom = DllStructGetData($sRect, 1, 4)
    Local $aPos
    Switch $wParam ;drag side or corner
        Case 1, 2, 4, 7
            $aPos = WinGetPos($hGui)
            If $left - $aPos[0] - $aPos[3] < -17 Then DllStructSetData($sRect, 1, $aPos[0] + $aPos[3] - 17, 1)
    EndSwitch
    Return "GUI_RUNDEFMSG"
EndFunc   ;==>WM_SIZING

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

@martin What i want to do is a Gui with combos and controls(no sizeable) and a second GUI with a list(this sizeable).. i want to my left side of the second GUI dont move from the right side of my main GUI

Oh, I think I see now. I hadn't noticed that the right-habd gui could be resized.

Give me a few minutes.

It might be simpler if you say that the gui can be resized from the right and the botton and the the top but not the left. Would that be acceptable?

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

Oh, I think I see now. I hadn't noticed that the right-habd gui could be resized.

Give me a few minutes.

It might be simpler if you say that the gui can be resized from the right and the botton and the the top but not the left. Would that be acceptable?

UEZ was there before me but maybe this small change is nearer

#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <guiconstantsex.au3>
$hGui = GUICreate("Armado de Resumen - Valiente Producciones", 500, 500, (@DesktopWidth / 2) - 500, -1)
GUISetState()
$aSize = WinGetClientSize($hGui)
$hListGui = GUICreate("Resumen de Trabajo - Valiente Producciones", $aSize[0], $aSize[1], 508, -7, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_MDICHILD, $hGui)

GUIRegisterMsg($WM_SIZING, "WM_SIZING")
GUISetState()

$aPos = WinGetPos($hListGui)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case -3
            Exit
    EndSwitch
WEnd

Func WM_SIZING($hWnd, $iMsg, $wParam, $lParam)
    Local $sRect = DllStructCreate("Int[4]", $lParam)
    Local $left = DllStructGetData($sRect, 1, 1)
    Local $top = DllStructGetData($sRect, 1, 2)
    Local $right = DllStructGetData($sRect, 1, 3)
    Local $bottom = DllStructGetData($sRect, 1, 4)
    Local $aPos
    Switch $wParam ;drag side or corner
        Case 1,  4, 7

            $aPos = WinGetPos($hGui)
            DllStructSetData($sRect, 1, $aPos[0] + $aPos[3] - 17, 1)
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_SIZING
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

I think you want this or?

Br,

UEZ

thanks... you solve it... is that what i want. i see that you use the lparam of the message and i realize that the lparam contains the structure with the size and position of the dragged GUI but i didnt know how to use it

PD : i atach a screen of the proyect advances... in my work i should keep a inventory of tasks..

@martin that works too

Edited by monoscout999
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...