Sign in to follow this  
Followers 0
neo291

How to resize/dock IPAddress field

7 posts in this topic

Hi!

i'm unable to set resize/dock properties for ipaddress field, and the result of which is whenever i maximize or resize gui, ipaddress field stays put wherever it was, which means it starts overlapping on other controls.

Can some1 pls help me with a solution ?

Herez an example form :-

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <IPAddressConstants.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>



#Region ### START Koda GUI section ### Form=f:\anticlut\autoit\examples\form2.kxf
$Form2 = GUICreate("Form2", 751, 501, 192, 131, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_SYSMENU,$WS_CAPTION,$WS_OVERLAPPEDWINDOW,$WS_TILEDWINDOW,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS))
$Pic1 = GUICtrlCreatePic("something.jpg", 0, 0, 750, 70, BitOR($SS_NOTIFY,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
GUICtrlSetResizing(-1, $GUI_DOCKTOP+$GUI_DOCKHCENTER+$GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "dgdfgdfg")
$Button1 = GUICtrlCreateButton("Button1", 700, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Button2 = GUICtrlCreateButton("Button1", 600, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Button3 = GUICtrlCreateButton("Button1", 650, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Button4 = GUICtrlCreateButton("Button1", 500, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Button5 = GUICtrlCreateButton("Button1", 550, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Tab1 = GUICtrlCreateTab(0, 70, 750, 430)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
GUICtrlSetState(-1,$GUI_SHOW)
$ListView1 = GUICtrlCreateListView("|||||||", 4, 95, 750, 350)
GUICtrlSendMsg(-1, 0x101E, 0, 50)
GUICtrlSendMsg(-1, 0x101E, 1, 50)
GUICtrlSendMsg(-1, 0x101E, 2, 50)
GUICtrlSendMsg(-1, 0x101E, 3, 50)
GUICtrlSendMsg(-1, 0x101E, 4, 50)
GUICtrlSendMsg(-1, 0x101E, 5, 50)
GUICtrlSendMsg(-1, 0x101E, 6, 50)
GUICtrlSendMsg(-1, 0x101E, 7, 50)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
$Label1 = GUICtrlCreateLabel("Label1", 5, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label2 = GUICtrlCreateLabel("Label1", 129, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label3 = GUICtrlCreateLabel("Label1", 399, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label4 = GUICtrlCreateLabel("Label1", 190, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label5 = GUICtrlCreateLabel("Label1", 264, 539, 36, 17)
$Label6 = GUICtrlCreateLabel("Label1", 264, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Label7 = GUICtrlCreateLabel("Label1", 324, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Input1 = GUICtrlCreateInput("Input1", 5, 460, 100, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Input3 = GUICtrlCreateInput("Input1", 197, 460, 100, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Input4 = GUICtrlCreateInput("Input1", 298, 460, 100, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Input5 = GUICtrlCreateInput("Input1", 399, 460, 348, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKBOTTOM+$GUI_DOCKHEIGHT)
$IPAddress1 = _GUICtrlIpAddress_Create($Form2, 104, 460, 90, 20)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$Combo1 = GUICtrlCreateCombo("Combo1", 5, 480, 100, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Combo2 = GUICtrlCreateCombo("Combo1", 104, 480, 90, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$Button6 = GUICtrlCreateButton("Button6", 192, 480, 100, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Pic1
Case $ListView1
Case $Tab1
EndSwitch
WEnd

I'm not a programmer. Just a Power User.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This should do it

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <IPAddressConstants.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>


#Region ### START Koda GUI section ### Form=f:\anticlut\autoit\examples\form2.kxf
$Form2 = GUICreate("Form2", 751, 501, 192, 131, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_SYSMENU, $WS_CAPTION, $WS_OVERLAPPEDWINDOW, $WS_TILEDWINDOW, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS))
$Pic1 = GUICtrlCreatePic("something.jpg", 0, 0, 750, 70, BitOR($SS_NOTIFY, $WS_GROUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKHCENTER + $GUI_DOCKHEIGHT)
GUICtrlSetTip(-1, "dgdfgdfg")
$Button1 = GUICtrlCreateButton("Button1", 700, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Button2 = GUICtrlCreateButton("Button1", 600, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Button3 = GUICtrlCreateButton("Button1", 650, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Button4 = GUICtrlCreateButton("Button1", 500, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Button5 = GUICtrlCreateButton("Button1", 550, 70, 50, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Tab1 = GUICtrlCreateTab(0, 70, 750, 430)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
GUICtrlSetState(-1, $GUI_SHOW)
$ListView1 = GUICtrlCreateListView("|||||||", 4, 95, 750, 350)
GUICtrlSendMsg(-1, 0x101E, 0, 50)
GUICtrlSendMsg(-1, 0x101E, 1, 50)
GUICtrlSendMsg(-1, 0x101E, 2, 50)
GUICtrlSendMsg(-1, 0x101E, 3, 50)
GUICtrlSendMsg(-1, 0x101E, 4, 50)
GUICtrlSendMsg(-1, 0x101E, 5, 50)
GUICtrlSendMsg(-1, 0x101E, 6, 50)
GUICtrlSendMsg(-1, 0x101E, 7, 50)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKBOTTOM)
$Label1 = GUICtrlCreateLabel("Label1", 5, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Label2 = GUICtrlCreateLabel("Label1", 129, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Label3 = GUICtrlCreateLabel("Label1", 399, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Label4 = GUICtrlCreateLabel("Label1", 190, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Label5 = GUICtrlCreateLabel("Label1", 264, 539, 36, 17)
$Label6 = GUICtrlCreateLabel("Label1", 264, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Label7 = GUICtrlCreateLabel("Label1", 324, 445, 36, 17)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Input1 = GUICtrlCreateInput("Inputx", 5, 460, 100, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Input3 = GUICtrlCreateInput("Input1", 197, 460, 100, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Input4 = GUICtrlCreateInput("Input1", 298, 460, 100, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Input5 = GUICtrlCreateInput("Input1", 399, 460, 348, 21)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT)
$IPAddress1 = _GUICtrlIpAddress_Create($Form2, 104, 460, 90, 20)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")
$Combo1 = GUICtrlCreateCombo("Combo1", 5, 480, 100, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Combo2 = GUICtrlCreateCombo("Combo1", 104, 480, 90, 25)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Button6 = GUICtrlCreateButton("Button6", 192, 480, 100, 20, 0)
GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


GUIRegisterMsg($WM_SIZE, "setippos")

;Global Const $WM_EXITSIZEMOVE = 0x0232
;GUIRegisterMsg($WM_EXITSIZEMOVE, "someotherfn")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Pic1
        Case $ListView1
        Case $Tab1
    EndSwitch
WEnd

Func setippos($hWnd,$iMsg,$Wparam,$lparam)
    Local $clientHt = BitShift($lparam,16)
    
    WinMove($IPAddress1, "", 104, 460-501+$clientHt)
EndFunc ;==>setippos
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

Share this post


Link to post
Share on other sites

Thanx a lot Martin!


I'm not a programmer. Just a Power User.

Share this post


Link to post
Share on other sites

@Zedna

Thanx for replying! U guys r doin great job by helpin ppl like me religiously.

But the question here was regarding repositioning ipaddfress field whenever gui is resized.

Btw, I had gone thru that post and thats how i got over first hitch. This is..was second hitch of sorts.


I'm not a programmer. Just a Power User.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thanks for tips guys! Was useful for me.

Also I've did some changes, and now IP address input box changes it position proportionally to window size. May be it will be useful for somebody too..

$GUIWidth = 401
$GUIHeigth = 528
$MainForm = GUICreate("Cisco Access Port Finder", $GUIWidth, $GUIHeigth, 661, 215, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_TABSTOP,$DS_MODALFRAME,$DS_SETFOREGROUND))
$IPAddress1 = _GUICtrlIpAddress_Create($MainForm, 225, 140, 165, 22)
_GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0")

GUIRegisterMsg($WM_SIZE, "setippos")

Func setippos($hWnd,$iMsg,$Wparam,$lparam)
    Local $clientWth = BitAND($lParam, 0xFFFF)
    Local $clientHt = BitShift($lparam,16)
    WinMove($IPAddress1, "", Int(225*$clientWth/$GUIWidth), Int(140*$clientHt/$GUIHeigth))
EndFunc ;==>setippos
Edited by Spaces

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