Possessed Posted June 5, 2008 Share Posted June 5, 2008 How would i keep the _GUICtrlIpAddress_Create control on one tab? And not have it on every other tab i add after it? Link to comment Share on other sites More sharing options...
Zedna Posted June 5, 2008 Share Posted June 5, 2008 When you create control on the Tab by UDF function (_GUICtrlCreate) and not by internal AutoIt's function (GUICtrlCreate) you must show/hide this control yourself.expandcollapse popup#include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <IPAddressConstants.au3> #include <TabConstants.au3> #include <GuiIPAddress.au3> #include <GuiTab.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 593, 453, 193, 115) $Tab1 = GUICtrlCreateTab(16, 24, 521, 385) $hTab = GUICtrlGetHandle($Tab1) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $IPAddress1 = _GUICtrlIpAddress_Create($Form1, 56, 112, 130, 21) _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") $MyButton1 = GUICtrlCreateButton("MyButton1", 104, 120, 100, 30, 0) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTab, $fValid $hWndTab = $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 $TCN_SELCHANGE If _GUICtrlTab_GetCurSel($hTab) = 0 Then ; zero based index of current selected TabItem _GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_SHOW) Else _GUICtrlIpAddress_ShowHide ($IPAddress1, @SW_HIDE) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFYCore of solution is to catch $TCN_SELCHANGE notification - when selection changes and show/hide what you want.Here is original post by Gary which I used as start for my example. http://www.autoitscript.com/forum/index.ph...st&p=421134 ioa747 and robertocm 2 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Possessed Posted June 9, 2008 Author Share Posted June 9, 2008 Thank you for the help. Works very nicely now 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