I am using a Tab3 control and am adding a single Edit control to each tab. Within my app, there are workflows I have coded which will also Delete tabs from this Tab control. It could be any tab.
Let's say I have three tabs. If I delete tab 2, then the Edit which was associated with Tab #2 is now associated with what used to be Tab #3. I'm not sure how I can fix this.
I've tried using a single Edit control and positioning it properly within the tabs inner region but this seems to cause issue with focusing the control.
And on those same lines, I don't see a way to move a control from one tab to another.
Anyone have any bright ideas?
[v2] TabControl children
-
- Posts: 264
- Joined: 09 Mar 2019, 01:52
- Location: Germany
- Contact:
Re: [v2] TabControl children
I don't know anything about GUI programming in AHK. It just an idea.
Is there a possibility to "hide" the tabs instead to delete them? So the association would remain to the tab.
Is there a possibility to "hide" the tabs instead to delete them? So the association would remain to the tab.
Re: [v2] TabControl children
Here's a simple example that demonstrates one of my problems.
Select Tab #2 and then click the button to remove that tab. If you then select the Tab with the text of 3, you will see that its content now has the "Text 2" control.
Select Tab #2 and then click the button to remove that tab. If you then select the Tab with the text of 3, you will see that its content now has the "Text 2" control.
Code: Select all
main := GuiCreate()
btn := main.addButton("", "Remove Tab")
btn.OnEvent("Click", (ctrl) => removeTab(ctrl.gui))
tabs := main.addTab3("w400 h400 vTabs", "1|2|3")
main.addText("", "Text 1")
tabs.useTab(2)
main.addText("", "Text 2")
tabs.useTab(3)
main.addText("", "Text 3")
tabs.useTab()
main.show()
Return
removeTab(gui) {
gui.control["Tabs"].Delete(gui.control["Tabs"].value)
}
Re: [v2] TabControl children
I haven't used v2 yet but this is what the doc for v1 says.
Have you considered making your own tabs?Tab controls: In addition to the behavior described in the paragraph above, a tab's sub-controls stay associated with their original tab number; that is, they are never associated with their tab's actual display-name. For this reason, renaming or removing a tab will not change the tab number to which the sub-controls belong. For example, if there are three tabs "Red|Green|Blue" and the second tab is removed by means of GuiControl,, MyTab, |Red|Blue, the sub-controls originally associated with Green will now be associated with Blue. Because of this behavior, only tabs at the end should generally be removed. Tabs that are removed in this way can be added back later, at which time they will reclaim their original set of controls.
-
- Posts: 264
- Joined: 09 Mar 2019, 01:52
- Location: Germany
- Contact:
Re: [v2] TabControl children
I would like to help. But GuiCreate() is a "nonexistent function" on my PC. I can't run your example.
Re: [v2] TabControl children
@Hellbent, I’m using several other Tab controls in the GUI and I’d like to maintain the look and feel of all tab controls.
With very preliminary testing, it seems if I use a Tab2 control that I can place a single edit control over the display area and then maintain the content for each Tab in memory. It could end up being more work than I’d like though.
With very preliminary testing, it seems if I use a Tab2 control that I can place a single edit control over the display area and then maintain the content for each Tab in memory. It could end up being more work than I’d like though.
Re: [v2] TabControl children
What about putting the tabs on a child gui embedded in your main gui and then just destroying and recreating the tab child when tabs are removed?
-
- Posts: 264
- Joined: 09 Mar 2019, 01:52
- Location: Germany
- Contact:
Re: [v2] TabControl children
I'm such a idi*t. Sorry. After a while I realised the [v2] in your post.Kobaltauge wrote: ↑17 Mar 2019, 12:38I would like to help. But GuiCreate() is a "nonexistent function" on my PC. I can't run your example.