Sign in to follow this  
Followers 0
mtmartis

IPAdress not passing input

3 posts in this topic

Hi,

Not sure if this should be in the GUI or General Support forum.

I have been unsuccessful in passing the input of _GUICtrlIpAddress_Get to a variable.

After I input an IP Address and click Connect , I want the input to be stored as a variable.

Any advice would be appreciated.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>

Global $Info
$Form1_1 = GUICreate("Connect", 381, 144, -1, -1)
$Img_Header = GUICtrlCreatePic(@ScriptDir & "\Header.bmp", 0, 0, 381, 63, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("IP Address :", 8, 80, 88, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Connect = GUICtrlCreateButton("Connect", 110, 113, 75, 25, 0)
$Cancel = GUICtrlCreateButton("Cancel", 190, 113, 75, 25, 0)
$Clear = GUICtrlCreateButton("Clear IP", 280, 77, 75, 25, 0)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1_1, 110, 80, 155, 21)
_GUICtrlIpAddress_Set($IPAddress1, "")
$IP = _GUICtrlIpAddress_Get($IPAddress1)
Pointer()

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
    Case $GUI_EVENT_CLOSE
        Exit
Case $Connect
    MsgBox(0,'',$IP)
Case $Cancel
    Exit
Case $Clear
    _GUICtrlIpAddress_ClearAddress($IPAddress1)

EndSwitch
WEnd

Func Pointer()
$Info= GUICtrlCreatePic(@ScriptDir & "\info.bmp", 358, 122, 20, 20, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetCursor(-1,0)
GUISetState()
EndFunc

Share this post


Link to post
Share on other sites



Think about it. Do you really want to read the IP as soon as the control is created? Wouldn't it be better to read it when the button is pressed?

Case $Connect
    $IP = _GUICtrlIpAddress_Get($IPAddress1)
    MsgBox(0,'',$IP)

Share this post


Link to post
Share on other sites

Think about it. Do you really want to read the IP as soon as the control is created? Wouldn't it be better to read it when the button is pressed?

Case $Connect
    $IP = _GUICtrlIpAddress_Get($IPAddress1)
    MsgBox(0,'',$IP)

Gah! I was so close. I thought the logic of it seemed odd, being in new territory, I figured it was entirely wrong.

Thanks for the clarification Admiral!

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