htrd Posted January 12, 2016 Share Posted January 12, 2016 (edited) Hi,I have a tab control in my GUI, which I want to create controls in - after creation of the GUI and the tab control.My problem is: To create or edit controls in the desired tab I have to switch to the tab with GUISwitch(...). Now when AutoIT switches to the tab, this is visible in the GUI.I want to be able to edit contols in the tab in the "background" so that the user doesn't see that this happens.I know that I can manually switch back to another tab by using GUISetState(), but I don't want the switching to be noticed at all, can anyone tell me how this is manageable? Thanks in advance PS: I know that I could set the GUI state to @SW_SHOW after all has been done, but that would be just a workaround. Edited January 12, 2016 by htrd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2016 Moderators Share Posted January 12, 2016 htrd,Welcome to the AutoIt forums.I have to switch to the tab with GUISwitch(...). Now when AutoIT switches to the tab, this is visible in the GUINot when I try:#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cTab = GUICtrlCreateTab(10, 10, 480, 200) $cTab_0 = GUICtrlCreateTabItem("Tab 0") GUICtrlCreateLabel("Tab 0 label", 50, 50, 200, 20) GUICtrlSetBkColor(-1, 0xFFCCCCC) $cTab_1 = GUICtrlCreateTabItem("Tab 1") GUICtrlCreateTabItem("") $cAction = GUICtrlCreateButton("Action", 10, 450, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cAction GUISwitch($hGUI, $cTab_1) GUICtrlCreateLabel("Tab 1 Label", 50, 50, 200, 20) GUICtrlSetBkColor(-1, 0xCCFFCC) GUISwitch($hGUI) EndSwitch WEndTo me that looks like:I want to be able to edit contols in the tab in the "background" so that the user doesn't see that this happensPerhaps if you posted the code you have been trying (see here how to do it) we might be able to see what you have done differently.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...
htrd Posted January 12, 2016 Author Share Posted January 12, 2016 (edited) Hey Melba, thanks for your reply!The difference is that after creating the controls in the specific tab, I end the creation with GUICtrlCreateTabItem("").The AutoIT help says:To create a new control on an existing tabitem use GUISwitch($hWin,$tabitem) to select it and just create your new control. Don't forget to close your tabitem creation with GUICtrlCreateTabItem("").I understand that I have to to use GUICtrlCreateTabItem("") after every change of the tab controls. If I omit it it works! But I don't know if that's the right way and won't cause other errors/behaviors. Also when using your code, when you first click on tab 1 and then you click on the Action Button, you don't see the change until you switch the tab and switch back to tab 1. Edited January 12, 2016 by htrd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 12, 2016 Moderators Share Posted January 12, 2016 htrd,Always obey the Help file! Try this instead:While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cAction ; Get selected tab $cTabSel = GUICtrlRead($cTab, 1) GUISwitch($hGUI, $cTab_1) GUICtrlCreateLabel("Tab 1 Label", 50, 50, 200, 20) GUICtrlSetBkColor(-1, 0xCCFFCC) GUICtrlCreateTabItem("") ; Reselect selected tab GUICtrlSetState($cTabSel, $GUI_SHOW) EndSwitch WEndThat does what you want when I test it.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...
htrd Posted January 12, 2016 Author Share Posted January 12, 2016 Thanks Melba,I will implement it in my code tommorow and then give you some feedback. Hope it works! Link to comment Share on other sites More sharing options...
htrd Posted January 13, 2016 Author Share Posted January 13, 2016 I don't quite understand why but this works like a charm!Thanks for the help Melba Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 13, 2016 Moderators Share Posted January 13, 2016 hrd,It works because you are repainting the tab control by reselecting a tab to show once the changes have been made. This way the changes will be implemented regardless of which tab is selected when they are made and it all happens so quickly the user does not notice.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...
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