Jump to content

Destroy tab


ajit
 Share

Recommended Posts

#include <ListViewConstants.au3>
#include <TabConstants.au3>
#include <GUIConstants.au3>

; GUI
$Admin = GuiCreate("ADMINISTRATOR", 1000, 700)

; TAB
$tabs = GuiCtrlCreateTab(10, 10, 986, 600, $TCS_FIXEDWIDTH) 
$TAB_1 = GuiCtrlCreateTabItem("Tab 1")
$MTLIST = GuiCtrlCreateListView("      Date      |   Doctor   |   Voice  File |      Duration      |        Size(KB)       |      User   |   Status   |   Text File   |   Default Template  |", 10, 40, 982, 568, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES )) ;998
$TAB_2 = GuiCtrlCreateTabItem("Tab 2")

GuiSetState()


While 1
        $msg = GUIGetMsg()
        
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
WEnd
    GUIDelete()

Hi:

I want my tabs to be created and closed(deleted/destroyed) with an icon on the tab button, like in IE-8 where one creates a new tab and closes by clicking on 'X' sign.

Is it possible?

Please help.

Ajit

Link to comment
Share on other sites

I would normally resort to the GuiTab.au3 UDF (_GuiCtrlTab_* functions in help file) and event mode, keeping the handles to the tab and tabitems in an array. But here's an attempt to keep it simple with the native GUI functions:

#include <ListViewConstants.au3>
#include <TabConstants.au3>
#include <GUIConstants.au3>

; GUI
$Admin = GUICreate("ADMINISTRATOR", 1000, 700)

; TAB
$tabs = GUICtrlCreateTab(10, 10, 986, 600, $TCS_FIXEDWIDTH)

; Tab items
$TAB_1 = GUICtrlCreateTabItem("Tab 1")
$idButton_Add = GUICtrlCreateButton("ADD", 20, 100, 100, 30)
$idButton_Del = GUICtrlCreateButton("DELETE", 20, 150, 100, 30)
$TAB_2 = GUICtrlCreateTabItem("Tab 2")
GUICtrlCreateTabItem("")
GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $idButton_Add
            ConsoleWrite("Debug: Add" & @LF)
            If $TAB_2 = 0 Then
                $TAB_2 = GUICtrlCreateTabItem("Tab 2")
                GUICtrlSetState(-1,$GUI_SHOW)
                GUICtrlCreateTabItem("")
            EndIf
        Case $idButton_Del
            ConsoleWrite("Debug: Delete" & @LF)
            If $TAB_2 <> 0 Then
                GUICtrlDelete($TAB_2)
                $TAB_2 = 0
            EndIf
    EndSwitch
WEnd

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...