Jump to content

GUICtrlIpAddress_Create Function


y0_Aero
 Share

Recommended Posts

Hello i was wondering if anyone could point out what's wrong with this code.

It's on it's own TAB and the IP Address inputbox displays but also shows on every other Tab aswell and i can't see where it references the other tabs?

$TabSheet3 = GUICtrlCreateTabItem("IP Tools")
GUICtrlSetState(-1,$GUI_SHOW)
GUICtrlCreateLabel("Ping an IP Address", 40, 48, 116, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Button5 = GUICtrlCreateButton("Ping", 48, 104, 97, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 24, 72, 145, 25)
_GUICtrlIpAddress_Set($IPAddress1, "127.0.0.1")

Any help would be appreciated.

 

Link to comment
Share on other sites

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

Global $YourIP = _GetIp()

$Form1 = GUICreate("Toolbox", 423, 309, 485, 177)
$PageControl1 = GUICtrlCreateTab(0, 8, 444, 320)
$TabSheet1 = GUICtrlCreateTabItem("Home")
$Pic2 = GUICtrlCreatePic("\\path", 4, 33, 417, 273)
$TabSheet2 = GUICtrlCreateTabItem("Project")
$Edit1 = GUICtrlCreateEdit("", 16, 72, 385, 185)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("Run Script", 16, 264, 89, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("Clear Text", 328, 264, 73, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label1 = GUICtrlCreateLabel("Enter the workstation names below ", 32, 56, 362, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Export Script", 224, 264, 89, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button4 = GUICtrlCreateButton("Import File", 120, 264, 89, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$TabSheet3 = GUICtrlCreateTabItem("IP Tools")
GUICtrlSetState(-1,$GUI_SHOW)
GUICtrlCreateLabel("Ping an IP Address", 40, 48, 116, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Button5 = GUICtrlCreateButton("Ping", 48, 104, 97, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 24, 72, 145, 25)
_GUICtrlIpAddress_Set($IPAddress1, "127.0.0.1")
$TabSheet4 = GUICtrlCreateTabItem("CMD")
$TabSheet5 = GUICtrlCreateTabItem("Programs")
$TabSheet6 = GUICtrlCreateTabItem("Active Directory")
$About = GUICtrlCreateTabItem("About")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

Hey Kovacic, Above is my whole GUI code including includes, every other tab works fine and doesn't overlap to other tabs it's just that IP input box.

Link to comment
Share on other sites

This fixes your issue, but it doesn't want to seem to keep the value of the control. Most controls work fine with tabs (except tables and custom built controls like this one), so I am just closing it when not in use. If this doesnt work for you, you may want to search for a method to simply move it off the view of the GUI while not in use ( like 1000,1000).

 

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



Global $YourIP = _GetIp()

$Form1 = GUICreate("Toolbox", 423, 309, 485, 177)
$PageControl1 = GUICtrlCreateTab(0, 8, 444, 320)
$TabSheet1 = GUICtrlCreateTabItem("Home")
$Pic2 = GUICtrlCreatePic("\\path", 4, 33, 417, 273)
$TabSheet2 = GUICtrlCreateTabItem("Project")
$Edit1 = GUICtrlCreateEdit("", 16, 72, 385, 185)
GUICtrlSetData(-1, "Edit1")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("Run Script", 16, 264, 89, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button2 = GUICtrlCreateButton("Clear Text", 328, 264, 73, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label1 = GUICtrlCreateLabel("Enter the workstation names below ", 32, 56, 362, 18)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button3 = GUICtrlCreateButton("Export Script", 224, 264, 89, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Button4 = GUICtrlCreateButton("Import File", 120, 264, 89, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$TabSheet3 = GUICtrlCreateTabItem("IP Tools")
GUICtrlSetState(-1,$GUI_SHOW)
GUICtrlCreateLabel("Ping an IP Address", 40, 48, 116, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Button5 = GUICtrlCreateButton("Ping", 48, 104, 97, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 24, 72, 145, 25)
_GUICtrlIpAddress_Set($IPAddress1, "127.0.0.1")
$TabSheet4 = GUICtrlCreateTabItem("CMD")
$TabSheet5 = GUICtrlCreateTabItem("Programs")
$TabSheet6 = GUICtrlCreateTabItem("Active Directory")
$About = GUICtrlCreateTabItem("About")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)

Global $LastIP = "127.0.0.1"

While 1

    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
         Case $PageControl1
            $LastIP = GuiCtrlRead($IPAddress1)
            if GUICtrlRead($PageControl1) = 2 then 
            $IPAddress1 = _GUICtrlIpAddress_Create($Form1, 24, 72, 145, 25)
            GuiCtrlSetData($IPAddress1, $LastIP)
            else
            _GUICtrlIpAddress_Destroy ($IPAddress1)
            endif

    EndSwitch
WEnd

 

C0d3 is P0etry( ͡° ͜ʖ ͡°)

Link to comment
Share on other sites

  • Moderators

y0_Aero,

The IPAddress control is created by a UDF and not by a native AutoIt function, so the tabs will not automatically deal with it. You need to do the hiding/showing yourself - the Tabs tutorial in the Wiki shows you how you do this.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...