SlowCoder74 Posted June 4, 2012 Share Posted June 4, 2012 (edited) I'm working on an application that starts with 2 tabs. Upon a user's login, it will present them with 2 more tabs. It's easy enough to add the new tabs. But I'd like the new tabs to appear to the left of the existing tabs. Is there any way to accomplish this in AutoIT? ... or maybe to hide the tabs until it's time to show them? Edited June 4, 2012 by SlowCoder74 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 4, 2012 Moderators Share Posted June 4, 2012 SlowCoder74, I think you will have to use the UDF functions for that: #include <GUIConstantsEx.au3> #include <GuiTab.au3> $hGUI = GUICreate("Test", 500, 500) $hTab = _GUICtrlTab_Create($hGUI, 10, 10, 480, 300) $hTab_0 = _GUICtrlTab_InsertItem($hTab, 0, "0") $hTab_1 = _GUICtrlTab_InsertItem($hTab, 1, "1") $cButton = GUICtrlCreateButton("Add", 10, 400, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton $hTab_2 = _GUICtrlTab_InsertItem($hTab, 0, "2") $hTab_3 = _GUICtrlTab_InsertItem($hTab, 1, "3") EndSwitch WEnd Or you could just delete and recreate the entire tab control if you want to use the native functions: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cTab = GUICtrlCreateTab(10, 10, 480, 300) $cTab_0 = GUICtrlCreateTabItem("0") $cTab_1 = GUICtrlCreateTabItem("1") GUICtrlCreateTabItem("") $cButton = GUICtrlCreateButton("Add", 10, 400, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton GUICtrlDelete($cTab) $cTab = GUICtrlCreateTab(10, 10, 480, 300) $cTab_0 = GUICtrlCreateTabItem("-2") $cTab_1 = GUICtrlCreateTabItem("-1") $cTab_2 = GUICtrlCreateTabItem("0") $cTab_3 = GUICtrlCreateTabItem("1") EndSwitch WEnd Any use? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 4, 2012 Moderators Share Posted June 4, 2012 (edited) Hi, slowcoder74. You mention after the user logs in. Do all users have the same rights on login, or are you attempting to set up different rights for different users? Depending on how you're handling your security (A.D. integrated, etc.) there are a couple of ways you could do this. Dang, too slow Edited June 4, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
SlowCoder74 Posted June 4, 2012 Author Share Posted June 4, 2012 @Melba23, I was moving in the direction of destroying and recreating, but I'll check out that UDF you posted. Thanks! @JLocal3o13, My application is designed to provide read-only information about the logged in Windows user and PC. Network admins can log into my app for more advanced management functions. FYI: In another attempt, I created a tabbed control with an embedded group control. When I disabled or hid the group control using GUICtrlSetState($Group1, $GUI_DISABLE), it remained enabled. I guess group controls can't be disabled or hidden? Here's my test code. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 413, 305, 245, 167) $Tab1 = GUICtrlCreateTab(48, 24, 281, 169) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlSetState(-1,$GUI_SHOW) $Group1 = GUICtrlCreateGroup("Group1", 88, 64, 177, 97) $Button1 = GUICtrlCreateButton("Button1", 112, 88, 97, 25) $Input1 = GUICtrlCreateInput("Input1", 120, 112, 121, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetState(-1, $GUI_HIDE) $Button2 = GUICtrlCreateButton("Enable", 128, 168, 73, 17) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button2 GUICtrlSetState($Group1,$GUI_ENABLE) GUICtrlSetState($Group1,$GUI_SHOW) EndSwitch WEnd Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 4, 2012 Moderators Share Posted June 4, 2012 (edited) You could always go the A.D. Security Group route, do something like this at the beginning, and then present the GUI based on whether the user is or is not in the group. Func _InGroup() _AD_Open() $sFQDN_User = _AD_SamAccountNameToFQDN() $sFQDN_Group = "MyAppGroup" $ingroup = _AD_IsMemberOf($sFQDN_Group, $sFQDN_User, False) _AD_Close() EndFunc Edited June 4, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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