Sign in to follow this  
Followers 0
Uriziel01

How to delete ALL controls

10 posts in this topic

I'm creating some graphics tool with meany of label controls, and after few minutes the script stop creating new controls because of limit controls in script. How to delete all controls in my window but not delete the window itself ? p.s-im really sory for my bad english but im learning it about 2 years "only". I would be really greatfull for all answers.


Share this post


Link to post
Share on other sites



If you are using an array of objects, which would be convenient, you could just For loop delete them.

Share this post


Link to post
Share on other sites

If I had several controls and had to Show, Hide, or Delete them, I would store the controls in an array and use a For..Next loop. small example:

Local $array[5]
$array[1] = GUICtrlCreate(...)
$array[2] = GRPÝÜX]JBÌÍØ^VÌ×HHÕRPÝÜX]JBÌÍØ^VÍHHÕRPÝ&Ä7&VFRâââ¢b33c¶'&³UÒÒuT7G&Ä7&VFRâââ ¤f÷"b33c¶ÒFòV&÷Væ ÀÌØíÉÉ䤴Ä(U%
Ñɱ±Ñ ÀÌØíÉÉålÀÌØí¥t¤í)ÕÍиáµÁ±°uld be used for anything
;~  GUICtrlSetState($array[$i], $GUWÒQJB^

Kurt :rolleyes:


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

we all now thah when we create control the GUICtrlCreate func return for us a Id of new control but if i put this id for Array i received error when i want to delete it, for ex. GUICtrlDelete ($c[$d]) for delete control and $d=GUICtrlCreateLabel ("", $a,$b,5,5) and _ArrayAdd( $c,$d) for puting the Id, im doing some simple misteake or what ?


Share this post


Link to post
Share on other sites

Yes but this dont work because i goth really huge amount of controls & i must do it in this metod:

$a=1
Local $array[$a]
do
$array[$a] = GUICtrlCreatJBÌÍØOIÌÍØJÌB[[ ÌÍØOLLÈÕRPÝ[]J    ÌÍزb33c¶Ò¢b33c¶Òb33c¶Ó¥VçFÂb33c¶Ó

Im right ? But this give me fatal error with "GUICtrlDelete($array[$a]) " some like too meany parametrs


Share this post


Link to post
Share on other sites

I don't think you understand correctly, perhaps try to learn off of this short example I created:

#include <GuiConstants.au3>

GuiCreate("", 300, 150)
Local ÌÍØ^VÌLBÌÍØ^VÌWHHÕRPÝÜX]P]Û   ][ÝÑSUHÓÓÓÉV÷C²ÃÃÃ#Ã#¢b33c¶'&³%ÒÒuT7G&Ä7&VFTÆ&VÂgV÷C·FW7BgV÷C²ÂÂS¤(ÀÌØíÉÉålÍtôU%
Ñɱ
ÉÑ1° ÅÕ½ÐíÑÍÐÅÕ½Ðì°ÔÀ°ÔÀ¤(ÀÌØíÉÉå4] = GUICtrlCreateLabel("test", 100, 50)
$array[5] = GUICtrlÜX]SX[
    ][ÝÝÝ    ][ÝËML
L
BÌÍØ^VÍHHÕRPÝÜX]SX[
    V÷C·FW7BgV÷C²Â#ÂS¢b33c¶'&³uÒÒuT7G&Ä7&VFTÆ&VÂgV÷C·FW7BgVÐì°ÈÔÀ°ÔÀ¤(ÀÌØíÉÉålátôU%
Ñɱ
ÉÑ1° ÅÕ½ÐíÑÍÐÅÕ½Ðì°À°ÄÀÀ¤(#036;array[9] = GUICtrlCreateLabel("test", 50, 100)
GUISetState()Ú[HBIÌÍÛÙÈHÕRQÙ]ÙÊ
BTÙ[XÝBPØÙH ÌÍÛÙÈH ÌÍØ^VÌW f÷"b33c¶ÒFòT&÷VæBb33c¶'&Ó uT7G&ÄFVÆWFRb33c¶'&²ÀÌØí¥t¤($$%9áÐ($%
ÍÀÌØíµÍôÀÌØíU%}Y9Q}
1=M($$%á¥Ð(%¹M±
WEnd

Kurt:D


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

Ok or im really dummy or that didnt work for $array[$amount] = GUICtrlCreateLabel("test", 0, 50)

meay i please you for do that script for, i think 1000 controls, im really dont understand why it give me error.


Share this post


Link to post
Share on other sites

Ok i give to you all the code of my script:

HotKeySet("{ESC}", "Exitt")
Func Exitt()
    Exit(1)
    EndF[ÂÜ
    ][ÝÕ^RXÛÛXYÉ][ÝËJBÚ[ÛYH    ÑÕRPÛÛÝ[Ë]LÉÝÂÚ[ÇVFRfÇC´'&æS2fwC°¤uT7&VFRgV÷C´Æöö²gV÷C²Ã#Ã#¤vÆö&Âb33í°ÀÌØí°ÀÌØíôÄ°ÀÌØíѬ°ÀÌØí°ÀÌØíélÄÀÁt°ÀÌØíè°ÀÌØíä)]¡¥e 1
    $a=0
    $b=0
Do
    $a=0
    Do
        $pos = MouseGetPos()
        ÌÍÜÜÖÌOIÌÍÜÜÖÌKLLBIÌÍÜÜÖÌWOIÌÍÜÜÖÌWKLLBIÌÍÝVÄvWD6öÆ÷"b33c·÷5³Ò²b33c¶Âb33c·÷5³Ò²b33c¶"¢b33c·¥²b33ctõU%
Ñɱ
ÉÑ1° ÅÕ½ÐìÅÕ½Ðì°ÀÌØí°ÀÌØí°Ô°Ô¤)U%
ÑɱMÑ   ­
½±½È-1,$var2)
$a=$a+5
Until $a=200
$b=$b+5
If &#0ÍØL[    ÌÍÞOLB[[ ÌÍØHÂQÕRPÝ[]H
    ÌÍÞÉÌͶ5Ò b33c¶3Òb33c¶2Ó VçFÂb33c¶3Ó uT7G&Å6WD&´6öÆ÷"ÓÂb33c·f#" U%
Ñɱ±Ñ ÀÌØí¤)U%MÑMÑÑ¡M]}M!=¤(ÀÌØíµÍôU%Ñ5Í ¤    $pos = MouseGetPos()
    $var = PixelGetColor( $pos[0], &#0ÍÜÜÖÌWH
BQÕRTÙ]ÐÛÛÜ
    ÌÍÝBY    ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓõ4RFVâWB¥vVæ@¢

Share this post


Link to post
Share on other sites

Hi,

If you want to delete "realy all" gui controls, then you need loop from 3 (i think) to the last control...

$Gui = GUICreate("Del All Controls Demo")

$Exit = GUIÝÜX]P]Û   ][ÝÑ^]    ][ÝË
LML
Ì
BÌÍÑ[]P[ÝÈHÕRPÝ&Ä7&VFT'WGFöâgV÷C´FVÆWFRÆÂ6öçG&öÇ2gV÷C²ÂSÂS ¤uT7G&Ä7&V1° ÅÕ½Ðí1°ÄÅÕ½Ðì°ÈÀ°ØÀ¤)U%
Ñɱ
ÉÑ1° ÅÕ½Ðí1°ÈÅÕ½Ðì°20, 80)
GUICtrlCreateLabel("Label 3", 20, 100)

GUISetState()

Wh[HBTÝÚ]ÚÕRQÙ]ÙÊ
BBPØÙHLË ÌÍÑ^]BBQ^]BPØÙH    ÌÍÑ[]PÆÄ7G&Ç0 ôW&6T6öçG&öÇ2b33c´wV VæE7vF6¥tVæ@ ¤gVæ2ôW&6T6öçG&öÇ2bÀÌØí¡]¹¤(%1½°ÀÌØí1ÍÑ
½¹Ñɽ°ô}Ñ1ÍÑ
Ñɱ9Õ´ ÀÌØí¡]¹¤(%½ÈÀÌØi = 3 To $LastControl+2
        GUICtrlDelete($i)
    Next
EndFunc

Func _Ù]ÝÝ[J ÌÍÚÛ
BSØØ[ ÌÍÐÛÜÓÝHÚ[Ù]ÛÜÓÝ
    ÌÍÚæB 7G&æu&WÆ6Rb33c´6Æ74Æ7BÂÄbÂgV÷C²gV÷C² &WGW&âWFVæFV@¤VæÕ¹

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


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
Sign in to follow this  
Followers 0