08-09-2012 05:14 PM
Hi smoothdurban,
If you set a breakpoint a the CallInteractionOn line, is it ever hit? Do you see the non-modal dialog that displays your "Click Here to Finish Viewing" text?
Cheers,
08-10-2012 06:22 AM
In the following cod segment
do while SUDDlgShow("DataPreview",MyFolders(0)&"Load File.SUD",NULL) <> "IDCancel" Call InteractionOn("Click Here to Finish Viewing") Call MsgBox("Break1") Loop Call MsgBox("break2")
I only see MsgBox "Break2" pop up. So I know the section of code inside the do while loop is not being executed.
08-10-2012 06:42 AM - edited 08-10-2012 06:44 AM
.
08-10-2012 03:25 PM
Hi Smooth,
That code you posted ran perfectly on my computer. The only thing I had to change was to add a space between "Call" and "InteractionOn". Of course I also had to create a dummy SUDialog with just one <OK> button on it. The InteractionOn button pops up every time I hit the <OK> button on the SUDialog.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-13-2012 06:26 AM
Hey Brad,
Does your ok button close the SUDialog box?
I believe the problem I am having is my button does call to close the dialog box therefore the program never reaches the InteractionOn() section of the code.
08-13-2012 08:54 AM
I found the error.
I was using a dialog.cancel call in my SUDialog as opposed to the dialog.ok.
The next task I would require assistance with would be to how I could use the cursor position in the VIEW window to grab either (or both) the X or Y coordinates of one or more displayed curves, which I intend to use to perform some calculations later on.
08-13-2012 03:15 PM
Hi Tim,
The X and Y cursor positions are easily read from the cursor object of the given sheet:
View.Sheets(1).Cursor.X1
View.Sheets(1).Cursor.X2
View.Sheets(1).Cursor.Y1
View.Sheets(1).Cursor.Y2
Note that the X2 position will only have valid data if you are using a band cursor or a frame cursor, and the Y2 position will only have valid data if you are using the frame cursor. You can set the cursor type in your script or save that with the TDV layout file.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-14-2012 09:50 AM
Once again Brad thanks for your help.
I did have another rather simple question. Is there a way I can ensure that only numerical values can be entered into a text box?
I am having difficulty referencing numeric values in text boxes as they are being viewed as text and not numerical values.
Thanks again
08-15-2012 09:21 AM
Hi Tim -
You can put a simple check within the EventChange event handler of your Edit Box that uses the IsNumeric() function. It might look something like this:
Sub EditBox1_EventChange(ByRef This) 'Created Event Handler If Not IsNumeric(EditBox1.Text) Then Msgbox("Please enter a numeric value instead") EditBox1.Text = 0 End If End Sub
If you're looking to convert an entry to a numeric value, use the CDbl() command. Let us know if this helps.
08-15-2012 09:31 AM
Hi Tim,
I was about to post the same advice as Derrick, so I'll try and add to it. If you want the user to be able to input numeric expressions as well, you can use the ProcessInput property.
While you might find this handy, certainly go for the Event handling option first. I would maybe recommend EventLostFocus over EventChange so that you're not performing the check on every character that's entered.
Cheers,