Dynamics for grouped objects

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
jll
Posts: 1
Joined: Tue Mar 04, 2014 9:20 am

Dynamics for grouped objects

Post by jll »

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();
}

}
}
*********************************************************

stuartm
Posts: 61
Joined: Thu Jun 06, 2013 9:21 am

Re: Dynamics for grouped objects

Post by stuartm »

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
AliasDynamics.png (62.62 KiB) Viewed 5861 times

Post Reply