Jump to content

"For ... to" Label creation. Delete them all?


eHrgo
 Share

Recommended Posts

Hi all,

Thanks for you time

I have something like this in one of my script:

Global $var=10

AutoItSetOption('GuiOnEventMode', 1)
GUICreate('', 100,200)
$button=GUICtrlCreateButton('clear', 5, 180, 90, 20)

GUICtrlSetOnEvent($button, 'clear')

For $i=1 To $var
    $text=GUICtrlCreateLabel('Number'&$i, 5, 15*$i, 90, 15) 
Next

Func clear()
GuiCtrlDelete($text)
EndFunc

While 1
    Sleep(40)
    GuiSetState(@SW_SHOW)
Wend

The only problem is I want the button clear to delete the whole 10 labels, instead of the last one, the $var is random, I'm not able to know how much label I've got.

Is there an easy way to do that?

Thanks

Sorry for my Bad English.
Link to comment
Share on other sites

The only problem is I want the button clear to delete the whole 10 labels, instead of the last one, the $var is random, I'm not able to know how much label I've got.

Possibly something like this?

Global $var = 10

AutoItSetOption('GuiOnEventMode', 1)
GUICreate('', 100, 200)
$button = GUICtrlCreateButton('clear', 5, 180, 90, 20)
Dim $text[$var +1]
GUICtrlSetOnEvent($button, 'clear')

For $i = 1 To $var Step 1
    $text[$i] = GUICtrlCreateLabel('Number' & $i, 5, 15 * $i, 90, 15)
Next

Func clear()
    For $i = $var To 1 Step - 1
        GUICtrlDelete($text[$i])
    Next
EndFunc   ;==>clear

While 1
    Sleep(40)
    GUISetState(@SW_SHOW)
WEnd

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

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