I'm trying to figure out if it's possible to create an object which comprises of individual objects where I can change the objects dynamics by scripting.
for example:
I create an Object that is basically 2 rectangles and a circle, which is then grouped.
I then want to have multiple instances of this object on a page where each instance will be connected to it's set of tags.
I know that I can use do this with a single object as shown in the code below, but I need to do this to an object that is comprised of more than one "children" objects.
I appreciate any ideas...
Thanks!
************************************************************
public partial class Plan1
{
//new Neo.ApplicationFramework.Controls.Controls.RectangleCF()
private List<Neo.ApplicationFramework.Controls.Controls.RectangleCF> boxes = new List<Neo.ApplicationFramework.Controls.Controls.RectangleCF>();
private int m_Position;
private Timer m_Timer;
void UpdateGrapics(System.Object sender, System.EventArgs e)
{
RepaintScreen();
}
void RepaintScreen()
{
for(var i = 0; i < boxes.Count; i++)
{
m_Position = Convert.ToInt16(boxes.Name.Substring(5));
if (Globals.Tags.DestArray[m_Position ].Value )
{
//Position occupied
boxes.Fill = new BrushCF(Color.BurlyWood );
}
else
{
//Position empty
boxes.Fill = new BrushCF(Color.Transparent );
}
}
}
void Plan1_Closed(System.Object sender, System.EventArgs e)
{
m_Timer.Enabled = false;
m_Timer.Tick -= UpdateGrapics;
}
void Plan1_Opened(System.Object sender, System.EventArgs e)
{
boxes.Add(m_Pos11);
boxes.Add(m_Pos12);
boxes.Add(m_Pos13);
boxes.Add(m_Pos14);
boxes.Add(m_Pos15);
boxes.Add(m_Pos16);
boxes.Add(m_Pos17);
m_Timer = new Timer();
m_Timer.Interval = Globals.Tags.PollGroup2.Interval; //2sec
m_Timer.Tick += UpdateGrapics;
m_Timer.Enabled = true;
RepaintScreen();
}
}
}
*********************************************************
Dynamics for grouped objects
Re: Dynamics for grouped objects
Please use aliases. It will save a lot coding. Besides, the screen gets re-instantiated so keeping private types will be pointless. Instead of assigning the dynamics to a tag, assign it to an alias.
- Attachments
-
- AliasDynamics.zip
- (596.13 KiB) Downloaded 600 times
-
- AliasDynamics.png (62.62 KiB) Viewed 5861 times