Jump to content

Unable to delete Updown with its input control


Go to solution Solved by Jos,

Recommended Posts

Hello forum,

I have a checkbox in main.au3 :

$Checkbox14 = GUICtrlCreateCheckbox("Item in First Backpack slot qty", 10, 266)
GUICtrlSetOnEvent($Checkbox14, "_Checkbox14")

I create a function which is called upon change in checkbox in separate functions.au3 script :

Func _Checkbox14()
    $i = GUICtrlRead($Checkbox14)
    If $i = 1 Then
        $Input1 = GUICtrlCreateInput("", 192, 266, 53, 21, 0x1)
        GUICtrlSetLimit($Input1, 2)
        $updown1 = GUICtrlCreateUpdown($Input1)
        GUICtrlSetLimit($Updown1, 99)
    Else
        GUICtrlDelete(-1)
    EndIF
EndFunc

What i want to achive is that when the checkbox is unchecked, the Input and Updown are deleted, but only the Updown get deleted.

I tried to use GUICtrlDelete(-1) twice, which has same result. I also tried to delete it with code below which is give "variable used without being declared" :

GUICtrlDelete($Input1)
GUICtrlDelete($Updown)

And when i set the variable with code below, i get nothing done :

Local $Input1, $Updown1

Can anyone help me on this one :)

Complete scripts attached. And oh, sorry for my bad English. :v

hmholv.zip

Edited by musahi0128
Link to post
Share on other sites
  • Developers
  • Solution

Try:

; put this at the top somewhere
Global $updown1,$Input1


Func _Checkbox14()
    $i = GUICtrlRead($Checkbox14)
    If $i = 1 Then
        $Input1 = GUICtrlCreateInput("", 192, 266, 53, 21, 0x1)
        GUICtrlSetLimit($Input1, 2)
        $updown1 = GUICtrlCreateUpdown($Input1)
        GUICtrlSetLimit($Updown1, 99)
    Else
        GUICtrlDelete($updown1)
    EndIF
EndFunc

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

    No registered users viewing this page.

×
×
  • Create New...