Jump to content

Recommended Posts

Posted

Hello,

i am having problem to create _GuiCtrlIpAddress_Create in Tab when i set the First Parameter as the Form its OK

is any one know how to fix it

Thanks,

Krikov

[topic="63488"][font="Arial"]Krikov Tray Quick Menu[/font][/topic]

  • Moderators
Posted (edited)

Krikov,

You need to create a child window to hold the GUI IP Address Control:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiIPAddress.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $hGUI, $hGUI_Child
    Local $tab, $tab0, $tab1
    Local $hIPAddress, $aMsg

    ; Create main GUI
    $hGUI = GUICreate("My GUI Tab with IP", 500, 500)

    ; Create a child window that will be incorparated into the main GUI
    $hGUI_Child = GUICreate("", 180, 70, 15, 35, BitOR($WS_CHILD, $WS_TABSTOP), -1, $hGUI)
    GUISetBkColor(0xFF0000, $hGUI_Child)
    $hIPAddress = _GUICtrlIpAddress_Create($hGUI_Child, 10, 10)
    GUISetState(@SW_HIDE)

    ; Go back to main GUI
    GUISwitch($hGUI)

    ; Create tab structure
    $tab = GUICtrlCreateTab(10, 10, 200, 100)

    $tab0 = GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    GUICtrlCreateButton("OK", 20, 50, 50, 20)
    GUICtrlCreateInput("Default", 80, 50, 70, 20)

    $tab1 = GUICtrlCreateTabItem("tab1")

    GUICtrlCreateTabItem("") ; end tabitem definition

    GUICtrlCreateLabel("label3", 20, 130, 50, 20)

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1

        $aMsg = GUIGetMsg(1)
        Switch $aMsg[0]
            Case $GUI_EVENT_CLOSE
                Exit
            Case $tab
                ; Show/Hide the child GUI as required
                Switch GUICtrlRead($tab)
                    Case 0
                        GUISetState(@SW_HIDE, $hGUI_Child)
                    Case 1
                        GUISetState(@SW_SHOW, $hGUI_Child)
                EndSwitch
        EndSwitch
    WEnd
EndFunc   ;==>Example

I hope this helps. :D

M23

Edit: Nice trick there, Zedna. :huggles:

Edited by Melba23

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:

  Reveal hidden contents

 

Posted (edited)

  On 2/2/2010 at 4:56 PM, 'Krikov said:

Hello,

i am having problem to create _GuiCtrlIpAddress_Create in Tab when i set the First Parameter as the Form its OK

is any one know how to fix it

Thanks,

Krikov

I think that you need to give the parent for the IP control which is a child window. You could just hide it or show it depending on which tab is selected using WinSetState.

#include <GUIConstantsEx.au3>
#Include <GuiIPAddress.au3>
Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $tab, $tab0, $tab0OK, $tab0input
    Local $tab1, $tab1combo, $tab1OK
    Local $tab2, $tab3, $tab2OK, $msg, $IP1
    Local $Gui
    $Gui = GUICreate("My GUI Tab") ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    $tab = GUICtrlCreateTab(10, 10, 200, 100)

    $tab0 = GUICtrlCreateTabItem("tab0")
    GUICtrlCreateLabel("label0", 30, 80, 50, 20)
    $tab0OK = GUICtrlCreateButton("OK0", 20, 50, 50, 20)
    $tab0input = GUICtrlCreateInput("default", 80, 50, 70, 20)

    $tab1 = GUICtrlCreateTabItem("tab----1")
    GUICtrlCreateLabel("label1", 30, 80, 50, 20)
    $tab1combo = GUICtrlCreateCombo("", 20, 50, 60, 120)
    GUICtrlSetData(-1, "Trids|CyberSlug|Larry|Jon|Tylo", "Jon") ; default Jon
    $tab1OK = GUICtrlCreateButton("OK1", 80, 50, 50, 20)
    $tab2 = GUICtrlCreateTabItem("IP")
    $IP1 = _GUICtrlIpAddress_Create ($Gui, 30, 50, 140, 25)
    WinSetState($IP1, "", @SW_HIDE)
    $tab3 = GUICtrlCreateTabItem("tab2")
    GUICtrlSetState(-1, $GUI_SHOW) ; will be display first
    GUICtrlCreateLabel("label2", 30, 80, 50, 20)
    $tab2OK = GUICtrlCreateButton("OK2", 140, 50, 50)

    GUICtrlCreateTabItem("")    ; end tabitem definition

    GUICtrlCreateLabel("label3", 20, 130, 50, 20)

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $tab
                ConsoleWrite("tab" & @CRLF)
                If GUICtrlRead($tab) = 2 Then
                    WinSetState($IP1, "", @SW_SHOW)
                Else
                    WinSetState($IP1, "", @SW_HIDE)
                EndIf
                
                
        EndSwitch
        
    WEnd
EndFunc ;==>Example

Edit:Ummm, a bit slow!

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...