Skip to content

Commit 75aaf87

Browse files
v2.0.5: Publicity to groups as well as fixing control settings.
2 parents eefa428 + 8e719ec commit 75aaf87

2 files changed

Lines changed: 84 additions & 20 deletions

File tree

EZCode/EZCode.cs

Lines changed: 83 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ public int mouseWheel
103103
/// <summary>
104104
/// List for windows
105105
/// </summary>
106-
private List<Window> windows;
106+
public List<Window> windows;
107107
/// <summary>
108108
/// List for variables
109109
/// </summary>
110110
public List<Var> vars;
111111
/// <summary>
112112
/// List of Groups
113113
/// </summary>
114-
private List<Group> groups;
114+
public List<Group> groups;
115115
/// <summary>
116116
/// List of all controls
117117
/// </summary>
@@ -1630,40 +1630,104 @@ async Task<string[]> PlaySwitch(string[]? _parts = null, string jumpsto = "", st
16301630
}
16311631
else if (getControl(keyword) != null)
16321632
{
1633-
Control? control = getControl(keyword);
1633+
Control? c = getControl(keyword);
16341634
if (parts[1] != "=")
16351635
{
1636-
control = await DoControl(parts, control.AccessibleDescription, 0);
1636+
c = await DoControl(parts, c.AccessibleDescription, 0);
16371637
}
16381638
else
16391639
{
1640+
Control? n = null;
16401641
GShape? s = null; GButton? b = null; GLabel? l = null; GTextBox? t = null;
1641-
switch (control.AccessibleDescription)
1642+
switch (c.AccessibleDescription)
16421643
{
16431644
case "shape":
1644-
s = control as GShape;
1645-
s = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Shape) as GShape : new GShape();
1646-
s.Name = control.Name;
1645+
s = c as GShape;
1646+
n = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Shape) as GShape : new GShape();
1647+
GShape? ns = n as GShape;
1648+
s.Points = ns.Points;
1649+
s.Poly = ns.Poly;
1650+
s.click = ns.click;
1651+
s.mousehover = ns.mousehover;
1652+
s.move = ns.move;
1653+
s.scale = ns.scale;
1654+
s.backcolor = ns.backcolor;
1655+
s.forecolor = ns.forecolor;
1656+
s.font = ns.font;
1657+
s.image = ns.image;
1658+
s.imagelayout = ns.imagelayout;
1659+
s.BGImageFile = ns.BGImageFile;
16471660
break;
16481661
case "button":
1649-
b = control as GButton;
1650-
b = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Button) as GButton : new GButton();
1651-
b.Name = control.Name;
1662+
b = c as GButton;
1663+
n = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Button) as GButton : new GButton();
1664+
GButton? nb = n as GButton;
1665+
b.isclick = nb.isclick;
1666+
b.AutoSize = nb.AutoSize;
1667+
b.click = nb.click;
1668+
b.mousehover = nb.mousehover;
1669+
b.move = nb.move;
1670+
b.scale = nb.scale;
1671+
b.backcolor = nb.backcolor;
1672+
b.forecolor = nb.forecolor;
1673+
b.font = nb.font;
1674+
b.image = nb.image;
1675+
b.imagelayout = nb.imagelayout;
1676+
b.BGImageFile = nb.BGImageFile;
16521677
break;
16531678
case "label":
1654-
l = control as GLabel;
1655-
l = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Label) as GLabel : new GLabel();
1656-
l.Name = control.Name;
1679+
l = c as GLabel;
1680+
n = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Label) as GLabel : new GLabel();
1681+
GLabel? nl = n as GLabel;
1682+
l.AutoSize = l.AutoSize;
1683+
l.click = nl.click;
1684+
l.mousehover = nl.mousehover;
1685+
l.move = nl.move;
1686+
l.scale = nl.scale;
1687+
l.backcolor = nl.backcolor;
1688+
l.forecolor = nl.forecolor;
1689+
l.font = nl.font;
1690+
l.image = nl.image;
1691+
l.imagelayout = nl.imagelayout;
1692+
l.BGImageFile = nl.BGImageFile;
16571693
break;
16581694
case "textbox":
1659-
t = control as GTextBox;
1660-
t = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Textbox) as GTextBox : new GTextBox();
1661-
t.Name = control.Name;
1695+
t = c as GTextBox;
1696+
n = parts[2] != "newcontrol" ? getControl(parts[2], controlType.Textbox) as GTextBox : new GTextBox();
1697+
GTextBox? nt = n as GTextBox;
1698+
t.AutoSize = nt.AutoSize;
1699+
t.Multiline = nt.Multiline;
1700+
t.WordWrap = nt.WordWrap;
1701+
t.ScrollBars = nt.ScrollBars;
1702+
t.click = nt.click;
1703+
t.mousehover = nt.mousehover;
1704+
t.move = nt.move;
1705+
t.scale = nt.scale;
1706+
t.backcolor = nt.backcolor;
1707+
t.forecolor = nt.forecolor;
1708+
t.font = nt.font;
1709+
t.image = nt.image;
1710+
t.imagelayout = nt.imagelayout;
1711+
t.BGImageFile = nt.BGImageFile;
16621712
break;
16631713
}
1664-
if (control == null || (s == null && b == null && l == null && t == null))
1714+
c.Left = n.Left;
1715+
c.Top = n.Top;
1716+
c.Width = n.Width;
1717+
c.Height = n.Height;
1718+
c.Text = n.Text;
1719+
c.AccessibleDescription = n.AccessibleDescription;
1720+
c.AccessibleName = n.AccessibleName;
1721+
c.BackColor = n.BackColor;
1722+
c.ForeColor = n.ForeColor;
1723+
c.Font = n.Font;
1724+
c.Enabled = n.Enabled;
1725+
c.BackgroundImage = n.BackgroundImage;
1726+
c.BackgroundImageLayout = n.BackgroundImageLayout;
1727+
1728+
if (c == null || n == null)
16651729
{
1666-
ErrorText(parts, ErrorTypes.custom, custom: $"An error occured when setting '{control.Name}' to '{parts[2]}' in {SegmentSeperator} {codeLine}");
1730+
ErrorText(parts, ErrorTypes.custom, custom: $"An error occured when setting '{c.Name}' to '{parts[2]}' in {SegmentSeperator} {codeLine}");
16671731
}
16681732
}
16691733
}

EZCode/Group.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace EZCode.Groups;
66

7-
class Group
7+
public class Group
88
{
99
public string Method { get; set; }
1010
public HashSet<GButton> Buttons = new HashSet<GButton>();

0 commit comments

Comments
 (0)