thegreatjedi 0 Posted April 21, 2020 Share Posted April 21, 2020 (edited) I've a GUI with 3 tabs. The current code (irrelevant bits omitted) is as follows: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <GuiIPAddress.au3> #include <GUIListBox.au3> #include <GuiRichEdit.au3> #include <Misc.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $g_hSAForm = GUICreate($g_sApplicationName, 801, 601, -1, -1) Global $g_hSATabs = GUICtrlCreateTab(0, 0, 800, 600) Global $g_hTestTabSheet = GUICtrlCreateTabItem("Tests") Global $g_hStatusDisplayEdit = _GUICtrlRichEdit_Create($g_hSAForm, "", 9, 30, 782, 266, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$WS_VSCROLL)) Global $g_hIpAddress = _GUICtrlIpAddress_Create($g_hSAForm, 172, 312, 130, 21) _GUICtrlIpAddress_Set($g_hIpAddress, "0.0.0.0") Global $g_hLogTabSheet = GUICtrlCreateTabItem("Log") Global $g_hLogDispEdit = GUICtrlCreateEdit("", 9, 30, 782, 511, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$WS_VSCROLL)) Global $g_hSettingsTabSheet = GUICtrlCreateTabItem("Settings") Global $g_hSvcProfileSettingsEdit = GUICtrlCreateEdit("", 9, 46, 782, 201, BitOR($ES_AUTOVSCROLL,$ES_READONLY,$WS_VSCROLL)) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($g_hStatusDisplayEdit) Exit Case $g_hSATabs Switch GUICtrlRead($g_hSATabs) Case 0 _GUICtrlIpAddress_ShowHide($g_hIpAddress, @SW_SHOW) WinSetState($g_hStatusDisplayEdit, "", @SW_SHOW) Case Else _GUICtrlIpAddress_ShowHide($g_hIpAddress, @SW_HIDE) WinSetState($g_hStatusDisplayEdit, "", @SW_HIDE) EndSwitch EndSwitch WEnd The first tab contains a RichEdit and a IpAddress (among other GUI elements). Whenever I switch to and from the first tab, those two elements show/hide as intended, but there is a noticeable lag. As a result, for example, I can still see these elements after switching to the third tab for a split second before they disappear. I'm very certain system resource availability isn't an issue. Is there a way to finish updating these two elements' visibility before the new tab selection is rendered? Edited April 21, 2020 by thegreatjedi Link to post Share on other sites
Moderators Melba23 3,799 Posted April 22, 2020 Moderators Share Posted April 22, 2020 thegreatjedi, As suggested in the Tabs tutorial in the Wiki, I would use ControlShow/Hide like this: Case $g_hSATabs Switch GUICtrlRead($g_hSATabs) Case 0 ControlShow($g_hSAForm, "", $g_hIpAddress) ControlShow($g_hSAForm, "", $g_hStatusDisplayEdit) ;_GUICtrlIpAddress_ShowHide($g_hIpAddress, @SW_SHOW) ;WinSetState($g_hStatusDisplayEdit, "", @SW_SHOW) Case Else ControlHide($g_hSAForm, "", $g_hIpAddress) ControlHide($g_hSAForm, "", $g_hStatusDisplayEdit) ;_GUICtrlIpAddress_ShowHide($g_hIpAddress, @SW_HIDE) ;WinSetState($g_hStatusDisplayEdit, "", @SW_HIDE) EndSwitch I get virtual instantaneous reaction from the 2 controls that way. 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 post Share on other sites
thegreatjedi 0 Posted April 22, 2020 Author Share Posted April 22, 2020 It works like a charm now. Thanks! Link to post Share on other sites
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