Years ago this was made. It has two rows of checkboxes or lines of script
Main question: how can i add a 3rd row instead of 2 like it is now:
Code: Select all
#SingleInstance Force
new Menu("Menu")
.Layout( "Registry1")
.Tab_Size(1300, 700)
.Show(400, 50)
return
GuiClose:
ExitApp
class Menu {
static Children := {} ;}
Tab_Width := A_ScreenWidth // 2
Tab_Height := A_ScreenHeight // 2
Tab_List := ""
__New(WinTitle) {
Gui, Menu: New, LabelGui, %WinTitle%
Gui, Font, s11, Segoe UI
}
Layout(args*) {
Loop, % args.length() ; FName = also name of #Include-files
FName := args[A_Index], _List .= "|" %FName%()
this.Tab_List := LTrim(_List, "|")
return this
}
Tab_Size(w, h) {
this.Tab_Width := w
this.Tab_Height := h
return this
}
AddText(ByRef Box) {
local pos := (Box[3] & 1)
? "yp x" this.Tab_Width // 2
: "y+3 xs"
Gui, Add, Text, % pos Box[1], % Box[2]
}
AddCheckbox(ByRef Box) {
local pos := (Box[4] & 1)
? "yp x" this.Tab_Width // 2
: "y+3 xs"
local Color := Box[1] ? "Green Checked" : "Red"
local VarName := Box[2]
local Box_onClick := this.toggleColour.Bind(this)
Gui, Add, Checkbox, %pos% c%Color% v%VarName%, % Box[3]
GuiControl +g, %VarName%, % Box_onClick
}
toggleColour(hWnd) {
GuiControlGet, State,, %hWnd%
GuiControl, % "+c" (State ? "Green" : "Red"), %hWnd%
}
AddTab(i, ByRef Child) {
Gui, Tab, %i%
if (Child.Boxes.Length()) {
Gui, Add, Button, HWNDhAll Section, ALLES selecteren
Gui, Add, Button, HWNDhNone x+m, NIETS selecteren
SelectAll_onClick := this.SelectAll.Bind(this)
SelectNone_onClick := this.SelectNone.Bind(this)
GuiControl +g, %hAll%, % SelectAll_onClick
GuiControl +g, %hNone%, % SelectNone_onClick
} else
Gui, Add, Text, w0 h0 Section, dummy
for each, CBox in Child.Boxes
this.AddCheckbox(CBox)
for each, TBox in Child.Texts
this.AddText(TBox)
if (Child.Callback) {
Gui, Add, Button, HWNDhCtrl xs, Start
Start_onClick := Func(Child.Callback).Bind(this)
GuiControl +g, %hCtrl%, % Start_onClick
}
}
SelectAll() {
GuiControlGet, Tab_Name,, SysTabControl321
for each, Child in Menu.Children
if (Child.Title = Tab_Name)
break
for each, VarName in Child.VarNames {
GuiControl,, %VarName%, 1
GuiControl, +cGreen, %VarName%
}
}
SelectNone() {
GuiControlGet, Tab_Name,, SysTabControl321
for each, Child in Menu.Children
if (Child.Title = Tab_Name)
break
for each, VarName in Child.VarNames {
GuiControl,, %VarName%, 0
GuiControl, +cRed, %VarName%
}
}
Show(x := "Center", y := "Center") {
w := this.Tab_Width, h := this.Tab_Height
Gui, Add, Tab2, w%w% h%h%, % this.Tab_List
Gui, Font, s10, Segoe UI
for i, Child in this.Children
this.AddTab(i, Child)
Gui, Color, % GuiColor := "ffffff"
Gui, Show, center
}
class Page {
Title := ""
CallBack := ""
VarNames := []
Boxes := []
Texts := []
__New(Title, CallBack := "") {
this.Title := Title
this.CallBack := CallBack
Menu.Children.Push(this)
}
AddCheckbox(Flag, VarName, Text) {
this.VarNames.Push(VarName)
this.Boxes.Push([Flag, VarName, Text, this.Boxes.Length()])
return this
}
AddText(Options, Text) {
this.Texts.Push([Options, Text, this.Texts.Length()])
return this
}
}
}
Registry1() {
new Menu.Page(Title := " Its a tab", "Start_Registry1")
.AddCheckbox( 1, "scripta", "some description")
.AddCheckbox( 1, "scriptb", "some description")
.AddCheckbox( 1, "scriptc", "some description")
return Title
}
return
Start_Registry1() {
global
Gui, Submit, NoHide
if scripta = 1
{
msgbox hi harmless
}
if scriptb = 1
{
msgbox whats up
}
if scriptc = 1
{
msgbox close me
}
}
return