08-15-2012 09:48 AM
Yes, definitely use EventLostFocus - wrote that way too quickly this morning. Thanks for catching that, Kyle!
08-15-2012 12:17 PM
Hey Guys thanks for the ideas. I was able to finsd the function inserted below that gets rid of any non numeric characters to ensure the data in the text box is numeric
I have used the EventLossFocus() as an event handler however I was wondering if there is a way I could use the EventCustomAction() to capture hitting enter on the keyboard as an event trigger?
Any Ideas?
Function parseInt(s) Dim regNum, n, a, i Set regNum = new RegExp regNum.Pattern = "[0-9]" n = "" for i = 1 to Len(s) a = Right(Left(s,i),1) if RegNum.Test(a) then n = n & a end if next If Len(n) = 0 Then parseInt = 0 Else parseInt = n End if End Function
08-16-2012 12:46 AM
Hi smoothdurban,
Attached you find an example for the EventCustomAction.
Greetings
Walter
08-21-2012 08:38 AM
Hey Brad,
Thanks for the info. The commands listed below allow the user to select the actual X Y values where I am am looking for some additional capabilities,
First is there a way to correlate what data row number this X value corresponds to? What I am and trying to do I to call the Find() function from the particular data point offset.
For Example
Find("ValueA >= ValueB", ChannelVals + Offset)
So I am asking the user to select where they want the script to begin searching for where ValueA is >+ ValueB from ChannelVals
Secondly
Is there a way to grab the X or Y values of the cursor when intersecting multiple curves? Currently if I call View,Sheets(1).Cursor.X1 it gives my the X1 value of the curve I have selected where I would like to grab the X1 Values of all of the curves in the view screen.
Thanks Again!
08-21-2012 08:54 AM
Hey Brad,
I was able to find a way to obtain the data point by simply using P1 or P2 as opposed to X1 or Y1.
However I am still looking to graph the data points from multiple curves simultaneously.
Thanks
08-22-2012 10:38 AM
Hi Tim,
The P1 and P2 properties are only reliable if your VIEW cursor is latched to a curve, so beware. The X1 and X2 properties always work. I don't understand what you mean about "plotting the points from multiple curves simultaneously". If you're in VIEW and accessing the cursor, don't you already have all the data plotted? Do you perhaps want to highlight selected data points?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-22-2012 02:45 PM
Hey Brad,
Allow me to elaborate
When I use the command to select data points either X1 or P1 it grabs the data point which is essentially the intersection point of the cursor and the selected curve.
If there are multiple curves and if I want to acquire the intersect point between the cursor and the another curve I have to select the other curve so the cursor then locks itself to the other curve.
What I am trying to do is to select all of the intersect points between the cursor and curves.
Thanks
08-23-2012 04:21 PM
Tim,
Could you have the script select the next curve after getting the intersection point from the first curve?
Cheers,
08-24-2012 06:58 AM
That's the solution I came up with.
I find the intersection point & value on one curve and then use that intersection value, utilizing the "Find()" function, to find the next curves intersection point.
See the code below.
CursorX1ValueArray(i) = View.Sheets(1).Cursor.P1 CursorX2ValueArray(i) = View.Sheets(1).Cursor.X1 R1 = CursorX2ValueArray(i) ResponseX1ValueArray(i) = Find("Ch(L3) >= R1", ResponseX1ValueArray(i) + 1)
08-29-2012 06:51 AM
I am not sure if I should of created a new thread for this but I figured I would continue this one as it pertains to using the Find() function.
I was able to call for user iteration using a SUDD1gShow() function within a do while loop as suggested. In my do While loop the user is prompted multiple time to select the desired data points. The series of prompts work fine and what I am basically doing is prompting the user for data points and then using the point coordinates to find the first instance of a Y value from that data point using the Find()
To add functionality I have given the user the chance to repeat the series of prompts if they are unhappy with the first set of selections. The problem I am having is when the user opts to reselect the starting data points the find function does not find matching values (thus Find() = 0) when it should be able to find the exact same first instance points a previously selected.
I suspect the Find() function is starting at a point where it had left off from the previous series of function calls, therefore telling me it did not find a data point which meets my conditions.
I have attached a partial section of code below that illustrates the series of prompts in the for loop. The problem when I am having is when the for loop is entered for the second time the Find() function doesn't find a satisfying condition which results is CtrlTimeVals(i) = 0.
do while SUDDlgShow("SelectStepDataPoints",MyFolders(0)&"Load File.SUD",NULL) <> "IDCancel" For i = 0 to NumberOfStepsSelected-1 Call InteractionOn("Click Here After "+ControlValueArray(i) +" Nm Load Point Has Been Selected") CtrlTimeVals(i)= Find("Ch(L2) >= R1", CtrlTimeVals(i)+ ControlPointValueArray(i)) Next Loop