Discussion of application development using iX Developer, including but not limited to getting started, using the functions tab, properties, objects and installation.
Hi, wondering if anyone else has encountered issues with this because I can't explain it. For whatever reason, in order to turn on the history for a trendviewer via script I'm having to turn it "Off". Here's the code I've got on a start/stop button:
void startButton_Click(System.Object sender, System.EventArgs e)
{
//TrendViewer1.ShowHistory("Toggle"); //this seriously doesn't work here but does on an separate button (other code snippet)
if(start == true){
chart.Start();
Globals.trendLogger.Start();
Globals.trendLogger.Log();
TrendViewer1.ShowHistory("On"); //this is backwards but it works correctly. I can not explain it
start = false;
}else {
TrendViewer1.ShowHistory("Off");
Globals.trendLogger.Stop();
chart.Stop();
start = true;
}
}
In my testing to see if there was a difference between my hand coded script and that generated by the tool, this is the autogenerated code that works:
I tested the below code and it switched the trend viewer into history mode as expected. It does not display a dialog box, it only toggles the trend viewer. You can tell because when the trend viewer is in history mode it says "History" below the X axis.
void Button1_Click(System.Object sender, System.EventArgs e)
{
this.TrendViewer1.ShowHistory("Toggle"); //this seriously doesn't work here but does on an separate button (other code snippet)
}
Are you sure you do not have an action on the same button that is toggling the history mode? Maybe some other code in your project is toggling the trend viewer history as well.
I think I might know what happened. I thought the button I was working with only had actions setup in the script environment... turns out I had a "Toggle" setup through the ui so they were likely fighting each other.