Jump to content

[Help] GuictrlcreateInput !


MrVietA2
 Share

Recommended Posts

Hello everyone !

I have a problem with my program :

#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("AutoIT", 182, 140, 505, 284)
$Combo1 = GUICtrlCreateCombo("1", 16, 40, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL,$WS_VSCROLL, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1,"2|Other")
$Label1 = GUICtrlCreateLabel("Combo", 16, 16, 37, 17)
$Label2 = GUICtrlCreateLabel("Input", 16, 80, 28, 17)
$Input = GUICtrlCreateInput("", 16, 104, 145, 21)
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Switch $Msg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Combo1
   Switch Guictrlread($Combo1)
    Case "1"
     GUICtrlSetData($Input,"1000")
    Case "2"
     GUICtrlSetData($Input,"2000")
    Case "Other"
     GUICtrlSetData($Input,"3000")
   EndSwitch
EndSwitch
WEnd

I would like when I choose Combo "1" or Combo "2" then make $Input to Read-Only, but when I choose Combo "3" then make $Input can be edit ! How can I do it :D ? Please help me !

Thanks !

Link to comment
Share on other sites

GUISetState(@SW_SHOW)
GUICtrlSetState($Input, $GUI_DISABLE)
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            Switch Guictrlread($Combo1)
                Case "1"
                    GUICtrlSetData($Input,"1000")
                    GUICtrlSetState($Input, $GUI_DISABLE)
                Case "2"
                    GUICtrlSetData($Input,"2000")
                    GUICtrlSetState($Input, $GUI_DISABLE)
                Case "Other"
                    GUICtrlSetState($Input, $GUI_ENABLE)
                    GUICtrlSetData($Input,"3000")
           EndSwitch
    EndSwitch
WEnd

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

i do not have that download manager so i assume that your looking for something like this

#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("AutoIT", 182, 140, 505, 284)
$Combo1 = GUICtrlCreateCombo("1", 16, 40, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL,$WS_VSCROLL, $CBS_DROPDOWNLIST))
GUICtrlSetData(-1,"2|Other")
$Label1 = GUICtrlCreateLabel("Combo", 16, 16, 37, 17)
$Label2 = GUICtrlCreateLabel("Input", 16, 80, 28, 17)
$Input = GUICtrlCreateInput("", 16, 104, 145, 21,$ES_NUMBER)
GUISetState(@SW_SHOW)
$clast = 1
Dim $speed[3] = [1000,2000,3000]
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Combo1
            Switch Guictrlread($Combo1)
                Case "1"
                    GUICtrlSetData($Input,$speed[0])
                    $clast = 1
                Case "2"
                    GUICtrlSetData($Input,$speed[1])
                    $clast = 2
                Case "Other"
                    GUICtrlSetData($Input,$speed[2])
                    $clast = "Other"
            EndSwitch
    EndSwitch
    If $clast <> "Other" And $speed[$clast] <> GUICtrlRead($Input) Then GUICtrlSetData($Input,$speed[$clast])
WEnd
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Oh,sorry ! I have a question about Input :D :

Can I do it for GuictrlcreateInput ? I don't want to use $ES_READONLY but I like bogQ's way. Thanks !

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("AutoIT", 275, 82, 409, 202)
GUICtrlCreateInput("", 16, 16, 241, 21) ;<--- here
$Button1 = GUICtrlCreateButton("OK", 96, 48, 83, 25)
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Switch $Msg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   Exit
EndSwitch
WEnd
Edited by MrVietA2
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...