qwert Posted April 26, 2018 Share Posted April 26, 2018 I've built a button-driven tab panel (based on a forum example) and placed an edit control on each tab — the second being a RichEdit control. (screen capture is below) Since a RichEdit is essentially a GUI of its own, what is the proper way to manage a rich edit control to at least give the appearance of it being on a tab panel? Thanks in advance for any help. expandcollapse popup; ; Example of button-driven tab panel ; #include <GUIConstants.au3> #include <GuiRichEdit.au3> Dim $TabSwitcher[2] $hGui = GUICreate("Button-driven tab panel", 360, 400) $TabSwitcher[0] = GUICtrlCreateLabel("Regular Edit", 10, 10, 100, 20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE) GUICtrlSetBkColor($TabSwitcher[0], 0xABCDEF) $TabSwitcher[1] = GUICtrlCreateLabel("Rich Edit", 120, 10, 90, 20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE) $tab = GUICtrlCreateTab(10, 40, 340, 340) $tab1 = GUICtrlCreateTabItem("tab1") $Input = GUICtrlCreateEdit("Regular text", 20, 80, 200, 200, $WS_VSCROLL) $tab2 = GUICtrlCreateTabItem("tab2") $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 100, 160, 200, 200, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_AppendText($hRichEdit, "This is rich text") GUICtrlSetState($tab, $GUI_HIDE) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -3 Exit Case $msg = $TabSwitcher[0] If GUICtrlRead($tab) <> 0 Then GUICtrlSetState($tab1, $GUI_SHOW) GUICtrlSetBkColor($TabSwitcher[0], 0xABCDEF) GUICtrlSetBkColor($TabSwitcher[1], 0xf0f0f0) Case $msg = $TabSwitcher[1] If GUICtrlRead($tab) <> 1 Then GUICtrlSetState($tab2, $GUI_SHOW) GUICtrlSetBkColor($TabSwitcher[0], 0xf0f0f0) GUICtrlSetBkColor($TabSwitcher[1], 0xABCDEF) EndSelect WEnd Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 26, 2018 Moderators Share Posted April 26, 2018 qwert, The Tabs tutorial in the Wiki shows how to deal with this problem. 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...
qwert Posted April 26, 2018 Author Share Posted April 26, 2018 Melba23, thanks for the nudge! I had searched help and these forums, but didn't think about the Wiki. Although it took me a moment to see the forest, the operative statement is: Quote Before going further, it is important to understand the differences between controls created using the built-in AutoIt commands (GUICtrlCreate*) and those created with the UDFs. I've never used Control Hide and Control Show statements, but I'm glad to see how they address a whole realm of possibilities. For anyone following this topic, I've updated my example, accordingly. Although the use of a tab control becomes almost an aside, I've left it in because it can support all the non-UDF controls. expandcollapse popup; ; Example of button-driven tab panel ; #include <GUIConstants.au3> #include <GuiRichEdit.au3> Dim $TabSwitcher[2] $hGui = GUICreate("Button-driven tab panel", 360, 400) $TabSwitcher[0] = GUICtrlCreateLabel("Regular Edit", 10, 10, 100, 20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE) GUICtrlSetBkColor($TabSwitcher[0], 0xABCDEF) $TabSwitcher[1] = GUICtrlCreateLabel("Rich Edit", 120, 10, 90, 20, $SS_SUNKEN +$SS_CENTER+ $SS_CENTERIMAGE) $tab = GUICtrlCreateTab(10, 40, 340, 340) $tab1 = GUICtrlCreateTabItem("tab1") $Input = GUICtrlCreateEdit("Regular text", 20, 80, 200, 200, $WS_VSCROLL) $tab2 = GUICtrlCreateTabItem("tab2") $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 100, 160, 200, 200, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_AppendText($hRichEdit, "This is rich text") GUICtrlSetState($tab, $GUI_HIDE) ControlHide($hGUI, "", $hRichEdit) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -3 Exit Case $msg = $TabSwitcher[0] ; If GUICtrlRead($tab) <> 0 Then GUICtrlSetState($tab1, $GUI_SHOW) GUICtrlSetBkColor($TabSwitcher[0], 0xABCDEF) GUICtrlSetBkColor($TabSwitcher[1], 0xf0f0f0) ControlHide($hGUI, "", $hRichEdit) ControlShow($hGUI, "", $Input) Case $msg = $TabSwitcher[1] ; If GUICtrlRead($tab) <> 1 Then GUICtrlSetState($tab2, $GUI_SHOW) GUICtrlSetBkColor($TabSwitcher[0], 0xf0f0f0) GUICtrlSetBkColor($TabSwitcher[1], 0xABCDEF) ControlHide($hGUI, "", $Input) ControlShow($hGUI, "", $hRichEdit) EndSelect WEnd 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