zhaicheng 0 Posted February 1, 2011 I want to make a muti-tab browser. Now the problem is that when closing a tab using "_GUICtrlTab_DeleteItem",controls on the tabitems are not deleted. I try to use GUICtrlDelete to destroy the control. But it seems to always delete the last one. Here is my code: $oIE = _IECreateEmbedded() $Sub = GUICreate("BootBars", 740, 700, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 40, 750, 560) If $msg = $Button4 Then _GUICtrlTab_DeleteItem($BB_Tab, 0) EndIf Share this post Link to post Share on other sites
Jfish 126 Posted February 1, 2011 Please post the rest of your code. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Share this post Link to post Share on other sites
zhaicheng 0 Posted February 2, 2011 expandcollapse popup#include <GUIConstants.au3> #include <GuiTab.au3> #include <array.au3> Opt("GuiOnEventMode", 1) GUICreate("My GUI Tab", 640, 480) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") $Tab = GUICtrlCreateTab(10, 10, 580, 400) $hTab = GUICtrlGetHandle($Tab) Dim $avTabItems[5] Dim $label[5] For $n = 0 To UBound($avTabItems) - 1 $avTabItems[$n] = GUICtrlCreateTabItem("Tab No." & $n) $label[$n] = GUICtrlCreateLabel("This is tab number " & $n & ".", 20, 100, 300, 20) GUICtrlSetOnEvent(-1, "_ButtonHit") GUICtrlCreateTabItem("") Next GUICtrlCreateLabel("Click button to delete a random tab:", 10, 420, 300, 20) GUICtrlCreateButton("Delete-A-Tab", 110, 440, 100, 30) GUICtrlSetOnEvent(-1, "_ButtonHit") GUISetState() While 1 Sleep(20) WEnd Func _ButtonHit() Local $sText = GUICtrlRead(@GUI_CtrlId) If StringLeft($sText, 7) = "Button " Then MsgBox(64, "Click!", "You clicked: " & $sText) ElseIf $sText = "Delete-A-Tab" Then Local $i = _GUICtrlTab_GetCurSel($hTab) GUICtrlDelete($label[$i]) _GUICtrlTab_DeleteItem($hTab, $i) _ArrayDelete($avTabItems, $i) If @error Then MsgBox(16, "Done", "You deleted the last tab! Goodbye...") Exit EndIf EndIf EndFunc ;==>_ButtonHit Func _Quit() Exit EndFunc ;==>_Quit Share this post Link to post Share on other sites
Jfish 126 Posted February 2, 2011 Hmmm. Well the code you posted does not match your original post at all. That said, maybe part of the problem is the way you are creating the tabs. The help file shows that _GUICtrlTab_DeleteItem is called after _GUICtrlTab_InsertItem even though you may have created the tab with GUICtrlCreateTab. Try this: $avTabItems[$n] = _GUICtrlTab_InsertItem($hTab,$n,"Tab No." & $n) Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Share this post Link to post Share on other sites
zhaicheng 0 Posted March 5, 2011 Jfish ,I really appreciate all your kind help. Share this post Link to post Share on other sites