Jump to content

[Solved]guictrlsetstate() For _GUICtrlIpAddress_Create() controlid why it didnt works?


Fire
 Share

Recommended Posts

Hi to all AutoIT Community.

I just wondering about

_GUICtrlIpAddress_Create()

So, my problem is in my GUI(see my script below) which i use in it

_GUICtrlIpAddress_Create()
.

In Result i have problem: I cannot apply to it $GUI_DISABLE or $GUI_ENABLE states with

Guictrlsetstate()
(Reason: I want to use it with CheckBox . )

And I think it cannot applicable for CONTROl ID`S which created with

_GUICtrlIpAddress_Create()

I cannot figure it out and in result i apply For that Controlid`s which created with

_GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_HIDE)
and
_GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_SHOW)
(NOTE: I dont want this way)

How to apply to this control id `s $GUI_DISABLE and $GUI_ENABLE states?

Am i right or i`m misunderstand somethink?

I use AutoIt v3.3.2.0

Any Hints,Helps is Greatly Appreciate.

Thanks in Advance & Sorry for my awfull English.

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

Local $state
$Form1 = GUICreate("TEST", 633, 372, 271, 172)
$Checkbox1 = GUICtrlCreateCheckbox("Activate", 456, 168, 161, 17)
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 208, 168, 177, 25)
_GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_HIDE)

_GUICtrlIpAddress_Set($IPAddress1, "127.0.0.1")



$Button1 = GUICtrlCreateButton("OK", 240, 272, 113, 25, $WS_GROUP)
GUICtrlSetState($Button1,$GUI_DISABLE)

$Tab1 = GUICtrlCreateTab(0, 0, 168, 21)
$tabitem0=GUICtrlCreateTabItem("First TabItem")

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("")

$tab2=GUICtrlCreateTabItem("Second Tabitem")
$Label1 = GUICtrlCreateLabel("SECOND TABITEM`S GUI", 184, 56, 131, 17)


GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) Then
                GUICtrlSetState($Button1,$GUI_ENABLE)
                _GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_SHOW)

            Else
                GUICtrlSetState($Button1,$GUI_DISABLE)
                _GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_HIDE)
            EndIf


        Case $Button1

            MsgBox(64,"TEST",_GUICtrlIpAddress_Get($IPAddress1))
        Case $Tab1

            Switch GUICtrlRead($Tab1)
                Case 0
                    GUICtrlSetState($Button1,$GUI_show)
                    GUICtrlSetState($Checkbox1,$GUI_show)
                    If BitAND(GUICtrlRead($Checkbox1),$GUI_CHECKED) Then
                        _GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_SHOW)
                    Else
                        _GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_HIDE)
                        EndIf




                Case 1
                    GUICtrlSetState($Button1,$GUI_HIDE)
                    GUICtrlSetState($Checkbox1,$GUI_HIDE)

                    ;GUICtrlDelete($Button1)

                    _GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_HIDE)


                    EndSwitch

    EndSwitch
WEnd
Edited by Sh3llC043r
[size="5"] [/size]
Link to comment
Share on other sites

Have a look at the udf which creates the ip control and you will see that it creates a window, so what you need is

WinSetState($IPAddress1,"",@SW_DISABLE)

and

WinSetState($IPAddress1,"",@SW_ENABLE)

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