
Graph Live Updateupon user interaction

rhjpires
It's the first time I am trying to use sliders and other controls to streamline the interaction of user with the script.
In a first attempt to do that, I have a slider that scales from 0 to 100 that will define a threshold which will sit between the minimum and the maximum value of a wave containing data. The threshold will be used towards finding peaks, and to better aid the user to define a suitable threshold, it should be plotted as a line across the graph where the data (containing a succession of small and large peaks) is also plotted. Now, I could do an update button to update the graph every time the thumb position is changed - but that's a bit too lame. Instead, the threshold line should update automatically. Can anyone please give me a hand, maybe with some example code, or with suggestion of core functions to do this? I did have a look at some of the examples that come with Igor, but a more direct and specific example would be of extra value to begin understanding this.
Many thanks in advance.
R.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 1, 2017 at 08:50 am - Permalink
thanks for the reply.
I post below the relevant part of the code. DisplayDataProc is called from another panel not shown here. Once called it creates a graph containing a control bar area with a slider and an update button next to it. This update button is what i use to define the threshold. ideally, I would like to get rid of it altogeher. Can you maybe illustrate what exactly you mean based on this?
Many thanks,
R.
May 1, 2017 at 10:00 am - Permalink
You need an action proc for the slider and SetVariable controls that does what the button's action proc does. If I were doing it, I would write a single function with appropriate inputs that changes the graph. Then call it from the two action procs.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 1, 2017 at 03:04 pm - Permalink
So I change controls from the button to the slider, and I appended the PROC to the slider01, and replaced the function control from ButtonControl to SliderControl. The whole thing compiles, but at runtime I get a syntax error of "expected right parenthesis".
Can anyone tell me what exactly I am doing wrong?
Currently, it looks like this:
May 5, 2017 at 04:58 am - Permalink
First, because this error occurs at runtime and not at compile, the problem may be related to the Execute statement.
Second, enable the debugger if you haven't tried this already. To enable it, right click on the procedure window and select the Enable Debugger item in the context menu. When the error occurs, Igor with open the debugger window with the execution point at the line after the position where the error occurred.
This may keep you afloat until real help arrives.
May 5, 2017 at 05:33 am - Permalink
The execute command, and the rest of the code, works fine until I change the control from Button to Slider.
The execute command adds a top control bar with a horizontal slider to allow sliding over the x-axis wit a small data-window; it is very useful for long datasets or with many features packed very closely together. It is in fact part of the standard Igor packages.
I did try using the debugger, but it did not highlight any errors, or warning signs. The moment, I click the slider01 thumb it is havoc: the syntax error dialog pops up telling me that it was expecting a right parenthesis somewhere and I cannot continue.
So by activating the slider with a mouse click I get a problem. I had no problems before in clicking in the slider to set the value for the associated variable.
So, I continue confused.
May 5, 2017 at 05:57 am - Permalink
A missing parenthesis should be caught during compile unless is occurs in a macro or if there is an error in the design of an Execute command. I would look at these two possibilities.
May 5, 2017 at 07:14 am - Permalink
But these action procs with simple input parameters are old-fashioned. You really should be using the ones that take a structure as input:
The structure-based procs give better performance, and when we create new features for a control, it is likely to be supported only by the structure-based versions. That's because it's easier to extend the structure for new features without breaking existing code.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
May 5, 2017 at 09:13 am - Permalink
I will have a look and post here later if run into problems.
Cheers,
R.
May 5, 2017 at 11:26 am - Permalink