Search the Community
Showing results for tags 'guictrlcreatecontextmenu'.
-
Hi, not sure if this really a conflict or im doing something wrong, but what is happening is that if i have $WS_EX_CONTROLPARENT in place, i can move the GUI around as expected, but there's no context menu, removing it the menu is back. #include <WindowsConstants.au3> $GUI = GUICreate('test', 300, 200, 150, 300, $WS_POPUP, $WS_EX_CONTROLPARENT) GUISetState(@SW_SHOW) Local $MainMenu = GUICtrlCreateContextMenu(-1) $OptMenu = GUICtrlCreateMenu("Options", $MainMenu) GUICtrlCreateMenuItem("111", $OptMenu, 0, 0) GUICtrlCreateMenuItem("222", $OptMenu, 1, 0) GUICtrlCreateMenuItem("333", $OptMenu, 2, 0) GUICtrlCreateMenuItem("444", $OptMenu, 3, 0) While 1 Sleep(100) WEnd
-
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.
-
Screenshot attached! I have a background image where all the buildings are black. When the distribution switches in the buildings respond to a ping, the buildings turn green. Dim $hImgMain = GUICtrlCreatePic("img\fullmap-nologo.gif",0,0,768,635) Dim $hImgAud = GUICtrlCreatePic("",263,287,36,27) Dim $hImgBus = GUICtrlCreatePic("",181,321,97,28) Dim $hImgCtr = GUICtrlCreatePic("",181,239,97,82) ... If ping($sIpAud) Then GUICtrlSetImage($hImgAud,"img\Green-Aud.gif") I'd like each building to have a context menu: $hMenuAud = GUICtrlCreateContextMenu($hImgAud) $hMenuAud1 = GUICtrlCreateMenu("Switch1",$hMenuAud) $hMenuAud1Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud1) $hMenuAud1Web = GUICtrlCreateMenuItem("Web",$hMenuAud1) $hMenuAud2 = GUICtrlCreateMenu("Switch2",$hMenuAud) $hMenuAud2Tel = GUICtrlCreateMenuItem("Telnet",$hMenuAud2) $hMenuAud2Web = GUICtrlCreateMenuItem("Web",$hMenuAud2) but the menus don't show up. Neither do tooltips. I'm sure this is something simple, but I've never really done anything like this before. Thanks!
- 2 replies
-
- pic
- context menu
-
(and 2 more)
Tagged with: