Adding controls to a tab does not add them
MyGui := Gui()
Tab := MyGui.Add("Tab3",, ["General","View","Settings"])
Tab.UseTab("General")
TabOneEdit := MyGui.Add("Edit", "w200 h200")
MyGui.Show("")
Comments (15)
-
-
Now for the keysharp screenshot. You can see the Edit is not “w200 h200”:
-
reporter Please test again.
The textbox height had nothing to do with tabs. Instead, text boxes are supposed to automatically become multi line if you specify a height or rows.
Also, I added some code to remove the unsightly dotted selection rectangle on the focused tab.
-
Retested. Works fine if only Edit controls are used. I’m using this code (uncomment 7 & 8 for the version with the bug):
MyGui := Gui() Tab := MyGui.Add("Tab3",, ["General","View","Settings"]) Tab.UseTab("General") GeneralEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("View") ViewEdit := MyGui.Add("Edit", "w200 h200") ;Tab.UseTab("Settings") ;SettingsText := MyGui.Add("Text", , "Just hanging around") MyGui.Show()
-
There is a workaround, but it seems fragile:
MyGui := Gui() Tab := MyGui.Add("Tab3",, ["General","View","Settings"]) Tab.UseTab("General") GeneralEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("Settings") SettingsEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("View") ViewText := MyGui.Add("Text", "w200 h200", "Just hanging around") MyGui.Show()
Note the dark background in keysharp, not sure what that means. It does seem that the height is determined in keysharp by the height of the smallest element or an element without width and height params.
-
reporter I’ve just committed, please try again.
Although, I worry this commit will always autosize the tab control based on its contents. I don’t think it’ll allow you to override the width and height.
-
Retested with this code:
MyGui := Gui() Tab := MyGui.Add("Tab3",, ["General","View","Settings"]) Tab.UseTab("General") GeneralEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("View") ViewEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("Settings") SettingsText := MyGui.Add("Text", , "Just hanging around") Tab.UseTab() MyGui.Add("Text", "w200 x10 y+10", "Placeholder for debugging") MyGui.Show()
Appears to be working fine! If you don’t mind, I’ll try to throw it a few more curveballs to see if I can break it.
(BTW, it is easy with 2.0-beta.6&7 to get REALLY unexpected results, and a check of the forums and docs will show that Tab controls have historically presented problems,)
-
MyGui := Gui() Tab := MyGui.Add("Tab3",, ["General","View","Settings"]) Tab.UseTab("General") GeneralEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab() Hose1 := MyGui.Add("Text", "w200 x10", "Trying to break this.") Tab.UseTab("View") ViewEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("Settings") SettingsText := MyGui.Add("Text", , "Just hanging around") Tab.UseTab() MyGui.Add("Text", "w200 x10 y+10", "Placeholder for debugging") MyGui.Show()
This code does different things in AHK and keysharp. Although I prefer the way keysharp does it, neither is what I expected.
-
On the other hand, the following code gives extremely similar results for AHK and keysharp:
MyGui := Gui() Tab := MyGui.Add("Tab3",, ["General","View","Settings"]) Tab.UseTab("General") GeneralEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("View") ViewEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("Settings") SettingsText := MyGui.Add("Text", , "Just hanging around") Tab.UseTab() MyGui.Add("Text", "w200 x10 y+10", "Placeholder for debugging") Tab.UseTab() Hose1 := MyGui.Add("Text", "w200 x10", "Trying to break this.") MyGui.Show()
-
You’ll notice is all I did was move the “trying to break this” section of the code.
-
More tab monkey business. This code gives the varying results shown below it. You can see the background color isn’t honored in keysharp.
MyGui := Gui() Tab := MyGui.AddTab("BackgroundFF9A9A", ["General","View","Settings"]) Tab.UseTab("General") TabOneEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("View") TabTwoEdit := MyGui.Add("Edit", "w200 h200") MyGui.Show()
Keysharp’s autosizing looks better here.
This code looks better in AHK (sizing is the same as keysharp’s) but still no color in keysharp.
MyGui := Gui() Tab := MyGui.Add("Tab3", "BackgroundFF9A9A", ["General","View","Settings"]) Tab.UseTab("General") TabOneEdit := MyGui.Add("Edit", "w200 h200") Tab.UseTab("View") TabTwoEdit := MyGui.Add("Edit", "w200 h200") MyGui.Show()
-
reporter I’ve committed fixes for the bug where you specify
y+10
as well as for the background coloring. -
Fixed, thank you!
-
reporter - changed status to resolved
-
reporter - changed status to closed
- Log in to comment
Tabs are now created. Control does not respect settings yet. Screenshots from code above.