4got Posted October 20, 2008 Share Posted October 20, 2008 I need to delete the content of a control tab without specify every times all the elements that are inside it... any ideas?? Link to comment Share on other sites More sharing options...
KabirSoftInc Posted October 20, 2008 Share Posted October 20, 2008 Clearing and deleting all the Labels,Buttons,Controls in a Tab? Link to comment Share on other sites More sharing options...
4got Posted October 20, 2008 Author Share Posted October 20, 2008 yes.I have to remove all the elements inside a control tab Link to comment Share on other sites More sharing options...
martin Posted October 20, 2008 Share Posted October 20, 2008 yes.I have to remove all the elements inside a control tabIf you create all the controls on one tab in sequence then you can simplify deleting them all like this ;create controls on tab2 $label = guiCtrlCreate.... . . .. $Combo = GuiCtrlCreate.... $Tab2First= $label $Tab2Last = $Combo ;end of control creation on tab2 . . ;delete all controls on Tab2 for $n = $Tab2First to $Tab2Last GuiControlDelete($n) next 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 More sharing options...
4got Posted October 21, 2008 Author Share Posted October 21, 2008 If you create all the controls on one tab in sequence then you can simplify deleting them all like this ;create controls on tab2 $label = guiCtrlCreate.... . . .. $Combo = GuiCtrlCreate.... $Tab2First= $label $Tab2Last = $Combo ;end of control creation on tab2 . . ;delete all controls on Tab2 for $n = $Tab2First to $Tab2Last GuiControlDelete($n) nextit's ok but the problem is that I have a window composed of a menu and a control tab;when I click on a menu item, the old control tab will be deleted and the new one will be loaded,but I couldn't know the elements that were in the old tab; I hope you understand, and forgive me if there are grammatical errors Link to comment Share on other sites More sharing options...
therks Posted October 21, 2008 Share Posted October 21, 2008 I'm pretty sure the only way to do that is to keep track of what items are in the tab from the start. I don't believe there's any way to figure out what items are associated to a tab after the fact. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
4got Posted October 21, 2008 Author Share Posted October 21, 2008 ok thx to all.. Link to comment Share on other sites More sharing options...
GEOSoft Posted October 21, 2008 Share Posted October 21, 2008 (edited) ok thx to all.. $iStart = GUICtrlCreateDummy() Create the controls here $iEnd = GUICtrlCreateDummy() For $i = $iStart to $iEnd GUICtrlDelete($i) Next Edited October 21, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
oMBRa Posted October 21, 2008 Share Posted October 21, 2008 I never figure out what is a dummy control Link to comment Share on other sites More sharing options...
4got Posted October 21, 2008 Author Share Posted October 21, 2008 I never figure out what is a dummy controlMe too ...By the way I've solved the problem :CODEFunc clear($inside) If $inside=0 Then $tab1=$tab $tab2=$Icon1 For $n=$tab1 To $tab2 GUICtrlDelete($n) next If $inside="another value" Then $tab1=$tab $tab2=$Icon2 For $n=$tab1 To $tab2 GUICtrlDelete($n) next .... .... EndIf EndFuncThis function clear the tab every time I click on the menu bar in order to load another tab. $inside is a control variable that is setted every time a new tab is loaded; every tab has a different value setted in this variable so the function recognise the elements to delete.. I hope to be clear in the explanations...thx again to all Link to comment Share on other sites More sharing options...
rasim Posted October 22, 2008 Share Posted October 22, 2008 oMBra I never figure out what is a dummy control 4got Me tooIt's no hard Example: expandcollapse popup#include <GuiConstantsEx.au3> $hGUI = GUICreate("Dummy control demo", 300, 200) $Tab = GUICtrlCreateTab(10, 10, 280, 150) $TabItem = GUICtrlCreateTabItem("Tab 1") $DummyStart = GUICtrlCreateDummy() GUICtrlCreateCombo("", 20, 40, 100, 20) GUICtrlCreateInput("", 180, 40, 100, 20) GUICtrlCreateEdit("", 20, 80, 260, 60) $DummyEnd = GUICtrlCreateDummy() GUICtrlCreateTabItem("") $ClearButton = GUICtrlCreateButton("Clear", 11, 169, 75, 23) $CloseButton = GUICtrlCreateButton("Close", 215, 169, 75, 23) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $CloseButton Exit Case $ClearButton _Clear() EndSwitch WEnd Func _Clear() Local $iCtl For $iCtl = $DummyStart To $DummyEnd GUICtrlDelete($iCtl) Next EndFunc ;==>_Clear Link to comment Share on other sites More sharing options...
4got Posted October 22, 2008 Author Share Posted October 22, 2008 (edited) It's no hard Example: expandcollapse popup#include <GuiConstantsEx.au3> $hGUI = GUICreate("Dummy control demo", 300, 200) $Tab = GUICtrlCreateTab(10, 10, 280, 150) $TabItem = GUICtrlCreateTabItem("Tab 1") $DummyStart = GUICtrlCreateDummy() GUICtrlCreateCombo("", 20, 40, 100, 20) GUICtrlCreateInput("", 180, 40, 100, 20) GUICtrlCreateEdit("", 20, 80, 260, 60) $DummyEnd = GUICtrlCreateDummy() GUICtrlCreateTabItem("") $ClearButton = GUICtrlCreateButton("Clear", 11, 169, 75, 23) $CloseButton = GUICtrlCreateButton("Close", 215, 169, 75, 23) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $CloseButton Exit Case $ClearButton _Clear() EndSwitch WEnd Func _Clear() Local $iCtl For $iCtl = $DummyStart To $DummyEnd GUICtrlDelete($iCtl) Next EndFunc ;==>_Clearnow I got it.... Edited October 22, 2008 by 4got Link to comment Share on other sites More sharing options...
oMBRa Posted October 22, 2008 Share Posted October 22, 2008 basically it hold some control ? Link to comment Share on other sites More sharing options...
4got Posted October 22, 2008 Author Share Posted October 22, 2008 (edited) basically it hold some control ?It's a sort of delimiter.In this case is used to delete easily a list of elements with a for cycle.Guys I'm sorry but solved a problem there are another hundred: Now I have a problem with a double while cycle:CODEWhile 1 $Msg = GUIGetMsg()Select Case $Msg=$ping_normal $tab=GUICtrlCreateTab(8, 40, 529, 345) $Label1=GUICtrlCreateLabel("Label1 :",30,55) $Label2=GUICtrlCreateLabel("Label2 :",160,55) ... ... $start=GUICtrlCreateButton("Start",300,50,60,25) $start=GUICtrlCreateButton("Exit",300,200,60,25) while 1 $msg=GUIGetMsg() Select Case $msg=$start MsgBox(0,"ping","ping") Case $msg=$exit ExitLoop EndSelect wend Case $Msg=$GUI_EVENT_CLOSE ExitLoopEndSelectWEndNow when I click on the EXIT button the program should exit this while loop:CODE while 1 $msg=GUIGetMsg() Select Case $msg=$start MsgBox(0,"ping","ping") Case $msg=$exit ExitLoop EndSelectwendOr am I wrong?Because when I click on the button the program exit the first while loop... Edited October 22, 2008 by 4got Link to comment Share on other sites More sharing options...
martin Posted October 22, 2008 Share Posted October 22, 2008 It's a sort of delimiter.In this case is used to delete easily a list of elements with a for cycle.Guys I'm sorry but solved a problem there are another hundred: Now I have a problem with a double while cycle:CODEWhile 1 $Msg = GUIGetMsg()Select Case $Msg=$ping_normal $tab=GUICtrlCreateTab(8, 40, 529, 345) $Label1=GUICtrlCreateLabel("Label1 :",30,55) $Label2=GUICtrlCreateLabel("Label2 :",160,55) ... ... $start=GUICtrlCreateButton("Start",300,50,60,25) $start=GUICtrlCreateButton("Exit",300,200,60,25) while 1 $msg=GUIGetMsg() Select Case $msg=$start MsgBox(0,"ping","ping") Case $msg=$exit ExitLoop EndSelect wend Case $Msg=$GUI_EVENT_CLOSE ExitLoopEndSelectWEndNow when I click on the EXIT button the program should exit this while loop:CODE while 1 $msg=GUIGetMsg() Select Case $msg=$start MsgBox(0,"ping","ping") Case $msg=$exit ExitLoop EndSelectwendOr am I wrong?Because when I click on the button the program exit the first while loop...You need to have a different variable name for the return from GuiGetMsg() in each loop or the check which exits theinner loop will also be true to exit the outer loop. 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 More sharing options...
4got Posted October 23, 2008 Author Share Posted October 23, 2008 in the first loop the name is $Msg ,in the second is $msg..I try to change the name but it doesn't work... Link to comment Share on other sites More sharing options...
GEOSoft Posted October 23, 2008 Share Posted October 23, 2008 in the first loop the name is $Msg ,in the second is $msg..I try to change the name but it doesn't work...AutoIt is not case sensitive so $Msg and $msg are the same. Use something like $Msg and $nMsg George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
4got Posted October 23, 2008 Author Share Posted October 23, 2008 AutoIt is not case sensitive so $Msg and $msg are the same. Use something like $Msg and $nMsgI tryied with $Msg and $message but it's the same thing... Link to comment Share on other sites More sharing options...
GEOSoft Posted October 24, 2008 Share Posted October 24, 2008 Post the whole thing again and I'll take a look at it. I just don't feel like getting bits and pieces from different posts. Just post what you actually have so far. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
4got Posted October 24, 2008 Author Share Posted October 24, 2008 CODE #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### ;---------------------------------windows and icon used-------------------------------- $gui = GUICreate("REMOTE CONTROLLER V3.0 BY 4got", 548, 407, 341, 177) ;GUISetIcon("") ;----------------------------------disclaimer's page----------------------------------- $tab = GUICtrlCreateTab(8, 40, 529, 345) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $Group1 = GUICtrlCreateGroup("Disclaimer:", 16, 56, 497, 161) GUICtrlCreateEdit("xxx", 88, 96, 393, 89,$ES_READONLY) $Icon1 = GUICtrlCreateIcon("xxx", 0, 24, 80, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP)) GUICtrlCreateGroup("", -99, -99, 1, 1) $Pic1 = GUICtrlCreatePic("xxx", 16, 224, 497, 153) ;Image ;-----------------------------------IP box--------------------------------------------- $ip_label = GUICtrlCreateLabel("IP Server", 8, 8, 63, 20) GUICtrlSetFont(-1, 10, 800, 0, "Arial") $ip_remote=GUICtrlCreateInput("0.0.0.0",72, 4, 89, 25) ;$IPAddress1 = _GUICtrlIpAddressCreate($gui, 72, 4, 137, 25) ;$ip_remote=_GUICtrlIpAddressSet($IPAddress1, "0.0.0.0") ;-----------------------------------menu---------------------------------------------- ;-----ping menu----- $ping = GUICtrlCreateMenu("Ping") $ping_normal=GUICtrlCreateMenuItem("Normal Ping",$ping) $ping_scan_ip=GUICtrlCreateMenuItem("IP scan",$ping) $ping_scan_port=GUICtrlCreateMenuItem("Port scan",$ping) ;------------------------------------------------------------------------------------- GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;-----------------------------function to clear the tab space-------------------------- Func clear($inside) If $inside=0 Then $tab1=$tab $tab2=$Icon1 For $n=$tab1 To $tab2 GUICtrlDelete($n) next EndIf EndFunc ;------------------------------------------------------------------------------------- $tab_inside=0 While 1 $Msg = GUIGetMsg() Select Case $Msg=$ping_normal clear($tab_inside) $tab_inside="ping_normal" $tab=GUICtrlCreateTab(8, 40, 529, 345) $Label_port=GUICtrlCreateLabel("Port :",30,55) $Label_delay=GUICtrlCreateLabel("Delay :",160,55) $delay=GUICtrlCreateInput("10",200,50,60,25,$ES_READONLY) $updown=GUICtrlCreateUpdown($delay) GUICtrlSetLimit($updown,"100","1") $port=GUICtrlCreateInput("80",60,50,60,25) $listaip=GUICtrlCreateEdit("",15,100,515,100,$ES_READONLY) $start_normal_ping=GUICtrlCreateButton("Ping",300,50,60,25) $exit=GUICtrlCreateButton("EXIT",380,50,60,25) while 1 $message=GUIGetMsg() Select Case $message=$start_normal_ping MsgBox(0,"ping","ping") $ip=GUICtrlRead($ip_remote) ;trova problema con loop $del=GUICtrlRead($delay) $por=GUICtrlRead($port) $result=Ping($ip,$del) If $result=0 Then ;if the ping hasn't a good result ;--------------------LIST OF VARIOUS ERROR ----------------------- $err=@error Select case $err=1 GUICtrlSetData($listaip,"Host is offline") case $err=2 GUICtrlSetData($listaip,"Host is unreachable") case $err=3 GUICtrlSetData($listaip,"Bad destination") case $err=4 GUICtrlSetData($listaip,"Unknown error") EndSelect ;----------------------------------------------------------------- Else GUICtrlSetData($listaip,"Host is online") ;if the ping has a good result EndIf Case $message=$exit ExitLoop(1) EndSelect wend ;$result = RunWait(@ComSpec & " /c ping www.google.com", "", @SW_HIDE) ;MsgBox(0, "Trial 1", "Result of google ping: " & $result) ;$result = RunWait(@ComSpec & " /c ping www.goble-de-gook.com", "", @SW_HIDE) ;MsgBox(0, "Trial 2", "Result of garbage ping: " & $result) Case $Msg=$GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now