DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Select and Use Data Points Script

Solved!
Go to solution

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,

KyleP
Applications Engineer
National Instruments
0 Kudos
Message 11 of 33
(2,862 Views)

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.

Tim
0 Kudos
Message 12 of 33
(2,857 Views)

.

0 Kudos
Message 13 of 33
(2,851 Views)

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

0 Kudos
Message 14 of 33
(2,837 Views)

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.

Tim
0 Kudos
Message 15 of 33
(2,831 Views)

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.

 

 

Tim
0 Kudos
Message 16 of 33
(2,826 Views)

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

0 Kudos
Message 17 of 33
(2,818 Views)

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

Tim
0 Kudos
Message 18 of 33
(2,809 Views)

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.

Derrick S.
Product Manager
NI DIAdem
National Instruments
Message 19 of 33
(2,802 Views)

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,

KyleP
Applications Engineer
National Instruments
0 Kudos
Message 20 of 33
(2,797 Views)