Jump to content

Search the Community

Showing results for tags 'guictrlcreatetabitem'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi, guys! I'm trying to create a Tab control which has a Context Menu on each Tab Item. But, since all Tab Items are part of the same Tab control, I will need to create only one Context Menu at time, deleting and creating a new one each time a new Tab Item is selected. My problem is that I can delete the old Context Menu in fact, but I'm not being able to create a new one once the form is created. This is a simplified example that represents the script that I'm trying to create: #include <GUIConstantsEx.au3> ; Variables Dim $Tab, $SelectedTab, $MainForm, $TabItem Dim $TabContext, $TabContextTitle, $Separator1, $Separator2, $Separator3, $Separator4, $Separator5 Dim $TabEdit, $TabCopy, $TabPaste, $TabDelete, $TabUndo Dim $DefaultTab = 1 ; Tab Item number that will be shown in front ; Arrays Dim $TabCopy[4] Dim $TabPaste[4] Dim $TabDelete[4] Dim $TabContextTitle[4] Dim $TabEdit[4] Dim $TabUndo[4] Dim $TabItem[4] Func Example() ; GUI $MainForm = GUICreate("My GUI Tab", 220, 120) $Tab = GUICtrlCreateTab(10, 10, 200, 100) $TabItem[1] = GUICtrlCreateTabItem("Tab1") $TabItem[2] = GUICtrlCreateTabItem("Tab2") $TabItem[3] = GUICtrlCreateTabItem("Tab3") GUICtrlCreateTabItem("") $TabContext = GUICtrlCreateContextMenu(-1) $TabContextTitle[$DefaultTab] = GUICtrlCreateMenuItem("Tab" & $DefaultTab, $TabContext) GUICtrlSetState(-1, $GUI_DEFBUTTON) $Separator1 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabEdit[$DefaultTab] = GUICtrlCreateMenuItem("Edit", $TabContext) $Separator2 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabCopy[$DefaultTab] = GUICtrlCreateMenuItem("Copy", $TabContext) $Separator3 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabPaste[$DefaultTab] = GUICtrlCreateMenuItem("Paste", $TabContext) $Separator4 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabDelete[$DefaultTab] = GUICtrlCreateMenuItem("Delete", $TabContext) $Separator5 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabUndo[$DefaultTab] = GUICtrlCreateMenuItem("Undo", $TabContext) GUICtrlSetState($TabItem[$DefaultTab], $GUI_SHOW) GUISetState(@SW_SHOW, $MainForm) $LastTab = $DefaultTab $SelectedTab = $DefaultTab EndFunc Func TabContextDelete($lt) ; Deletes Tab Context Menu GUICtrlDelete($TabContext) GUICtrlDelete($TabContextTitle[$lt]) GUICtrlDelete($Separator1) GUICtrlDelete($TabEdit[$lt]) GUICtrlDelete($Separator2) GUICtrlDelete($TabCopy[$lt]) GUICtrlDelete($Separator3) GUICtrlDelete($TabPaste[$lt]) GUICtrlDelete($Separator4) GUICtrlDelete($TabDelete[$lt]) GUICtrlDelete($Separator5) GUICtrlDelete($TabUndo[$lt]) EndFunc Func TabContextUpdate($st) ; Should Create a New Tab Context Menu $TabContext = GUICtrlCreateContextMenu($MainForm) $TabContextTitle[$st] = GUICtrlCreateMenuItem("Tab" & $st, $TabContext) GUICtrlSetState(-1, $GUI_DEFBUTTON) $Separator1 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabEdit[$st] = GUICtrlCreateMenuItem("Edit", $TabContext) $Separator2 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabCopy[$st] = GUICtrlCreateMenuItem("Copy", $TabContext) $Separator3 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabPaste[$st] = GUICtrlCreateMenuItem("Paste", $TabContext) $Separator4 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabDelete[$st] = GUICtrlCreateMenuItem("Delete", $TabContext) $Separator5 = GUICtrlCreateMenuItem("", $TabContext) ; separator $TabUndo[$st] = GUICtrlCreateMenuItem("Undo", $TabContext) EndFunc Example() While 1 $GuiMsg = GUIGetMsg(1) Switch $GuiMsg[0] Case $Tab $LastTab = $SelectedTab $SelectedTab = GUICtrlRead($Tab) + 1 TabContextDelete($LastTab) TabContextUpdate($SelectedTab) Case $GUI_EVENT_CLOSE Exit EndSwitch WEndCould you please explain me what I am doing wrong or give me an alternative solution? Thanks in advance.
×
×
  • Create New...