Page 1 of 1

v2: Fail to create Tab control

Posted: 01 Jul 2020, 05:21
by aseiot
Fail to create Tab control, Following is an example code in help file:

Code: Select all

MyGui := Gui.New()
Tab := MyGui.Add("Tab3",, ["First Tab","Second Tab","Third Tab"])
MyGui.Add("Checkbox", "vMyCheckbox", "Sample checkbox") 
Tab.UseTab(2)
MyGui.Add("Radio", "vMyRadio", "Sample radio1")
MyGui.Add("Radio",, "Sample radio2")
Tab.UseTab(3)
MyGui.Add("Edit", "vMyEdit r5")  ; r5 means 5 rows tall.
Tab.UseTab()  ; i.e. subsequently-added controls will not belong to the tab control.
Btn := MyGui.Add("Button", "default xm", "OK")  ; xm puts it at the bottom left corner.
Btn.OnEvent("Click", (*) => ProcessUserInput(Gui))
MyGui.OnEvent("Close", "ProcessUserInput")
MyGui.OnEvent("Escape", "ProcessUserInput")
MyGui.Show()

ProcessUserInput(this, *)
{
    Saved := this.Submit()  ; Save the contents of named controls into an object.
    MsgBox("You entered:`n" Saved.MyCheckbox "`n" Saved.MyRadio "`n" Saved.MyEdit)
}

Re: v2: Fail to create Tab control

Posted: 01 Jul 2020, 06:03
by Ragnar
If you mean the error which occurs after pressing OK, fix it by replacing ProcessUserInput(Gui) with ProcessUserInput(MyGui).

If you mean the display issues (no tabs etc.), you are right - it is a bug. This seems to affect only "Tab3" and "Tab2". "Tab" works correctly.

Re: v2: Fail to create Tab control

Posted: 01 Jul 2020, 20:13
by kczx3
I am seeing the same thing as Ragnar

Re: v2: Fail to create Tab control

Posted: 05 Jul 2020, 19:29
by aseiot
Ragnar wrote:
01 Jul 2020, 06:03
If you mean the error which occurs after pressing OK, fix it by replacing ProcessUserInput(Gui) with ProcessUserInput(MyGui).

If you mean the display issues (no tabs etc.), you are right - it is a bug. This seems to affect only "Tab3" and "Tab2". "Tab" works correctly.
Yes, I mean display issues.

Re: v2: Fail to create Tab control  Topic is solved

Posted: 06 Jul 2020, 05:43
by lexikos
There are two bugs:
  1. The Text parameter of MyGui.Add is ignored by Tab3 and Tab2, so the control actually has no tabs.
  2. The position of the tab dialog (the window that contains a Tab3's controls) is not updated when tabs are added, only when the Tab control is moved.
You can work around it like this:

Code: Select all

MyGui := Gui.New()
Tab := MyGui.Add("Tab3")
Tab.Add(["First Tab","Second Tab","Third Tab"])
Tab.GetPos(x)
Tab.Move(x)
MyGui.Show()
Or get v2.0-a115.