Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Dynamics for grouped objects
PostPosted: Tue Mar 04, 2014 11:50 am 

Joined: Tue Mar 04, 2014 9:20 am
Posts: 1

Offline
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[i].Name.Substring(5));

if (Globals.Tags.DestArray[m_Position ].Value )
{
//Position occupied
boxes[i].Fill = new BrushCF(Color.BurlyWood );
}
else
{
//Position empty
boxes[i].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();
}

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


 Profile  
 
 Post subject: Re: Dynamics for grouped objects
PostPosted: Wed Apr 23, 2014 4:48 pm 

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

Offline
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 129 times
AliasDynamics.png
AliasDynamics.png [ 62.62 KiB | Viewed 1528 times ]
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron