I have a scenario where I have a screen with multiple aliases and instances that are directly related to analog numeric text boxes.
(Scenario: Instances - w1, w2, w3
Aliases - a1, a2, a3
a1 a2 a3
w1 tag1_1 tag2_1 tag3_1
w1 tag1_2 tag2_2 tag3_2
w1 tag1_3 tag2_3 tag3_3)
I have the screen dynamically select an instance based on an internal tag which increments or decrements based on the user selected well and thus the tag in the alias referenced should change but unfortunately it is not. Any Ideas?
Using the following for the screen change
switch(Globals.Tags.SelectedInstance.Value.Int)
{
case 0:
Globals.Screen.W1.Show();
break;
case 1:
Globals.Screen.W2.Show();
break;
case 2:
Globals.Screen.W3.Show();
break;
}
Use of Instances
Re: Use of Instances
Hi!
If you post your project I´m sure we can help you, but it´s a bit hard to see the problem from your explanation...
Best Regards
If you post your project I´m sure we can help you, but it´s a bit hard to see the problem from your explanation...
Best Regards
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: Use of Instances
You might want to take a look at this forum post for some example code.
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
-
- Posts: 13
- Joined: Mon Mar 11, 2013 8:48 am
Re: Use of Instances
Sorry, I know my explanations are as clear as mud. Here is an example of the code...
- Attachments
-
- Example.png (21.29 KiB) Viewed 11597 times
Re: Use of Instances
Works good for me, I also made some changes/improvements...
Try the attached project
Best Regards
Code: Select all
void btnBack_Click(System.Object sender, System.EventArgs e)
{
GetInstance(--Globals.Tags.Selected_Insance.Value);
}
void btnNext_Click(System.Object sender, System.EventArgs e)
{
GetInstance(++Globals.Tags.Selected_Insance.Value);
}
void GetInstance(int newInstasIndex)
{
switch(Globals.Tags.Selected_Insance.Value.Int)
{
case 0: Globals.Tags.Selected_Insance.Value = 0; break;
case 1:
if(this.InstanceName != "Instance1")
Globals.Instance_Window.Instance1.Show();
break;
case 2:
if(this.InstanceName != "Instance2")
Globals.Instance_Window.Instance2.Show();
break;
case 3:
if(this.InstanceName != "Instance3")
Globals.Instance_Window.Instance3.Show();
break;
case 4: Globals.Tags.Selected_Insance.Value = 3; break;
}
}
Best Regards
- Attachments
-
- iX_Instance_Switch.zip
- (30.08 KiB) Downloaded 817 times
Re: Use of Instances
CRAP!
There was an error in my previous post (and attached project).
In the switch statment and case 0, it set the current instance to zero but it should have been 1.
So if you try please change it to
Regards
There was an error in my previous post (and attached project).
In the switch statment and case 0, it set the current instance to zero but it should have been 1.
So if you try please change it to
Code: Select all
case 0: Globals.Tags.Selected_Insance.Value = 1; break;
Regards