lordicast Posted December 7, 2007 Share Posted December 7, 2007 (edited) Right click menu on a TAB is there a way to do it? I want to be able to click one of these tabs and select a func. ;Example Gui(that works PSalty lol) CODE#include <GUIConstants.au3> $Form2 = GUICreate("tavy", 413, 298, 303, 219) $tabo = GUICtrlCreateTab(8, 24, 396, 256) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $Tab1 = GUICtrlCreateTabItem("Tab1") $Tab2 = GUICtrlCreateTabItem("Tab2") $Tab3 = GUICtrlCreateTabItem("Tab3") GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd I cant attach a menu using (not working but a start on the menu) CODE $hFile = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hFile, 0, "&New", $none) _GUICtrlMenu_InsertMenuItem ($hFile, 1, "&Open", $none) _GUICtrlMenu_InsertMenuItem ($hFile, 2, "&Save", $none) _GUICtrlMenu_InsertMenuItem ($hFile, 3, "", 0) _GUICtrlMenu_InsertMenuItem ($hFile, 4, "Close", $none) $hMain = _GUICtrlMenu_CreateMenu () _GUICtrlMenu_InsertMenuItem ($hMain, 0, "", 0, $tab1) Edited December 7, 2007 by lordicast [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
lordicast Posted December 7, 2007 Author Share Posted December 7, 2007 ^Bump [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
lordicast Posted December 8, 2007 Author Share Posted December 8, 2007 Ok i figured out the drop down when the user right clicks on a TAB using expandcollapse popupFunc WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTab $hWndTab = $hTab If Not IsHWnd($hTab) Then $hWndTab = GUICtrlGetHandle($hTab) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTab Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; The return value is ignored by the tab control Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1; nonzero to not allow the default processing Return 0; zero to allow the default processing Case $NM_RCLICK ; The user has clicked the right mouse button within the control _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1; nonzero to not allow the default processing Return 0; zero to allow the default processing Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control _DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1; nonzero to not allow the default processing Return 0; zero to allow the default processing Case $NM_RELEASEDCAPTURE; control is releasing mouse capture _DebugPrint("$NM_RELEASEDCAPTURE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Problem is now i have to use the _GUICtrlTab_InsertItem command and now i dont know how to insert a object within a tab. where it use to be as easy as.. $TabSheet4 = GUICtrlCreateTabItem("New Tab") GUICtrlCreateEdit("", 40, 96, 713, 566) to insert a object into tab1 this doesnt work as easily.. _GUICtrlTab_InsertItem ($hTab, 0, "Tab 1") GUICtrlCreateEdit("", 40, 96, 713, 566) sample i got to work with expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiTab.au3> Opt('MustDeclareVars', 1) $Debug_TAB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $hTab _Main() Func _Main() Local $hGUI ; Create GUI $hGUI = GUICreate("Tab Control Create", 400, 300) $hTab = _GUICtrlTab_Create ($hGUI, 2, 2, 396, 296) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Add tabs _GUICtrlTab_InsertItem ($hTab, 0, "Tab 1") _GUICtrlTab_InsertItem ($hTab, 1, "Tab 2") _GUICtrlTab_InsertItem ($hTab, 2, "Tab 3") ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTab $hWndTab = $hTab If Not IsHWnd($hTab) Then $hWndTab = GUICtrlGetHandle($hTab) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTab Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; The return value is ignored by the tab control Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1; nonzero to not allow the default processing Return 0; zero to allow the default processing Case $NM_RCLICK ; The user has clicked the right mouse button within the control _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1; nonzero to not allow the default processing Return 0; zero to allow the default processing Case $NM_RDBLCLK ; The user has clicked the right mouse button within the control _DebugPrint("$NM_RDBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ;~ Return 1; nonzero to not allow the default processing Return 0; zero to allow the default processing Case $NM_RELEASEDCAPTURE; control is releasing mouse capture _DebugPrint("$NM_RELEASEDCAPTURE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) ; No return value EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint help my head hurts! [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
martin Posted December 8, 2007 Share Posted December 8, 2007 Problem is now i have to use the _GUICtrlTab_InsertItem commandand now i dont know how to insert a object within a tab.where it use to be as easy as..$TabSheet4 = GUICtrlCreateTabItem("New Tab")GUICtrlCreateEdit("", 40, 96, 713, 566)Use _GUICtrlTab_SetCurFocus ($hTab, $TabPage), where $TabPage is the zero based index of the tab items, then create your control and it will be created on that tab item. 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...
lordicast Posted December 8, 2007 Author Share Posted December 8, 2007 (edited) It just displays the edit over all 3 tabs. this is what im using $hTab = _GUICtrlTab_Create ($hGUI, 2, 2, 396, 296) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Add tabs _GUICtrlTab_InsertItem ($hTab, 0, "Tab 1") _GUICtrlTab_SetCurFocus($hTab,0) GUICtrlCreateEdit("", 12, 24, 300, 200) _GUICtrlTab_InsertItem ($hTab, 1, "Tab 2") _GUICtrlTab_InsertItem ($hTab, 2, "Tab 3") Edited December 8, 2007 by lordicast [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
martin Posted December 8, 2007 Share Posted December 8, 2007 (edited) It just displays the edit over all 3 tabs. this is what im using $hTab = _GUICtrlTab_Create ($hGUI, 2, 2, 396, 296) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Add tabs _GUICtrlTab_InsertItem ($hTab, 0, "Tab 1") _GUICtrlTab_SetCurFocus($hTab,0) GUICtrlCreateEdit("", 12, 24, 300, 200) _GUICtrlTab_InsertItem ($hTab, 1, "Tab 2") _GUICtrlTab_InsertItem ($hTab, 2, "Tab 3") Looks like there is something wrong with guitab.au3 or our understanding. I assume that you have to keep track of the controls on each tab because all that happens when a page is selected is that the tab at the top is redrawn. So you have to set the controls as hidden or shown depending on which tab is active. Maybe this is done automatically with the built-in AutoIt tab functions, and maybe that is why you have to end the tab creation with GuiCtrlCreateTabItem(""). Edited December 8, 2007 by martin 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...
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