SUD-Dialog Variablen-​Rückgabe

Hallo NI'ler,
ich erstelle gerade meinen ersten SUD-Dialog mit 5 CheckBoxen. Je nach dem, welche Box nun aktiviert wurde, soll eine Variable einen anderen Wert zugewiesen bekommen. Mein bisheriger Ansatz war
Sub CheckBox1_EventChange()
Dim This : Set This = CheckBox1
 checkbox1.RunChange
 L1 = 1
 checkbox2.Value = 0
End Sub
Im VBS-Script sollte dann per "msgbox" der entsprechende Wert von L1 ausgegeben werden. Egal, welche der Boxen aktiviert wird, erhalte ich "0" als Rückgabewert. Könnte mir bitte jemand die korrekte vorgehensweise erklären?
Danke!
Björn
Message Edited by bk220 on 11-02-2007 09:38 AM

Hallo Björn!
Doch noch was Zeit gefunden
Das grundsätzliche Problem bei deinem Code ist das du wechselweise die Werte von Controls in den Change Events änderst. Dazu kurz ein Umweg in die Theorie: Hat man z.B. zwei Checkboxen in einem Dialog so werden bei jeder Änderung die zugehörige EventChange Routine ausgeführt. Eine Änderung kann interaktiv durchen Anwender erfolgen oder aber durch Ändern des Wertes (Value-Eigenschaft) per Skript. Wird nun in der EventChange Routine des ersten CcheckBox der Wert der zweiten Checkbox verändert so wird auch sofort deren EventChange durchlaufen. Beachtet man dies nicht kommt es zu 'seltsamen' Verhalten.
Das führte dann bei dir dazu das du einen RunChange Aufruf zur Hilfe nehmen musstes damit es überhaupt irgendwie funktionierte. Mach mal Messageboxen in die Routinen und spiel mal was damit herum.
Nun zur Lösung (meine, es gibt da mehrere mögliche Ansätze):
Ich würde in jeden EventChange-Routine einen Aufruf in eine globale Routine machen und die notwendigen Werte als Parameter übergeben. Das sieht dann für die ersten beiden CheckBoxen so aus:
Sub CheckBox1_EventChange()
Dim This : Set This = CheckBox1
Call UpdateCheckBox(1,CheckBox1.Value)
End Sub
Sub CheckBox2_EventChange()
Dim This : Set This = CheckBox2
Call UpdateCheckBox(2,CheckBox2.Value)
End Sub
Die globale Routine sieht dann so aus:
Public Sub UpdateCheckBox(Byref nNo, Byref nValue)
If (L1 <> nNo) And (nValue = 1) Then
' es hat sich was geändert
L1 = nNo
Elseif (L1 = nNo) And (nValue = 0) Then
' auch alle AUS zulassen
L1 = 0
End If
' Umwandlung L1 Wert in gecheckte Box
checkbox1.Value = (L1 = 1)
checkbox2.Value = (L1 = 2)
checkbox3.Value = (L1 = 3)
checkbox4.Value = (L1 = 4)
checkbox5.Value = (L1 = 5)
checkbox6.Value = (L1 = 6)
checkbox7.Value = (L1 = 7)
End Sub
Die richtigen Zustände der Checkboxen werden dort gesammelt aus L1 abgeleitet. Die Logik ist so das auch alle Boxen aus sein dürfen. Die Logik am Anfang verhindert Rekursionen.
Ich hoffe das hilft
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  

Similar Messages

  • SUD Dialog - Vorgabewerte in einer Edit/Combo-Box - Anzeigen von Werten die in einem vorgehendem Durchlauf eingeben wurden

    Ziel ist es in einem SUD Dialog Vorgabewerte in einer Edit/Combo-Box anzeigen zu lassen, um diese Daten nicht bei jedem Aufruf der Autosequenz neu eingeben zu müssen. Sie sollen aber nicht in einer List-Box ausgewählt werden, sondern in einer Edit/combo-Box. Als Vorgabewerte sollten die zuletzt bei einem Durchlauf der Autosequenz eingegebenen Werte oder Texte in dem Fenster der Box erscheinen. Könnte man hier Variablen verwenden? Müssen diese in dem static Fenster eingegeben werden, bzw. mit welcher Befehlszeile?
    Sub EditBox5_EventInitialize()
    Dim This : Set This = EditBox5
    End Sub
    Wir verwenden noch DIAdem 8.0

    Hallo Herr Gutknecht,
    Sie koennen eine DIAdem VAS-Variable von Typ "A" oder "G" benutzen und diese der Combobox als zugehoerige Variable zuweisen. Die moeglichen Werte der "A" oder "G" Variable bleiben von SUD-Start zu SUD-Start in DIAdem erhalten, sowie auch der zuletzt-gewaehlte Wert der Variable. Beim naechsten SUD-Start wird dieser zuletz-gewaehlte Wert in der Combobox dargestellt.
    Mit schoenen Gruessen,
    Brad Turpin
    DIAdem Product Support Engineer (USA)
    National Instruments

  • Aufruf SUD-Dialog während einer Messung

    Ich verwende den DAC-Teil von DIAdem zum Messen und Regeln mehrerer unabhängiger Prüfstände. Aus regelungstechnischen Gründen möchte ich, dass die Messung ständig läuft. Da die Prüflinge jedoch wechseln, müssen prüflingsspezifische Daten (Texte + Werte) während laufender Messung geändert werden. Über einen SUD-Dialog der anwenderdefinierte Variabeln beliefert, realisiere ich das vor Start der Messung bereits. Bisher ist mir noch nicht gelungen diesen Dialog während der Messung über VBS-Dateigerüst von Script-DAC-Treiber aufzurufen. Wie kann ich das realisieren? Ein Beispiel hierzu würde mir sehr helfen. Danke.

    Hallo,
    ich stand bereits vor dem gleichen Problem. Es wird nicht möglich sein, dass irgend ein "offline-Teil" von Diadem (Dialog, Script, offline-Mathematik, Report) und ein DAC-Schaltplan gleichzeitig aktiv sind.
    Eingaben in einen laufenden DAC-Schaltplan sind nur über die Eingabeelemente von DAC möglich. Ich habe diese temporären Eingabeelemente in Unterschaltplänen gruppiert und schalte sie nur bei Bedarf sichtbar. Die Eingaben können über den Block "Speicherung in Variablen" in Variablen abgelegt werden.
    Martin Bohm
    [email protected]

  • How to select, with a SUD DIALOG, the range and the trace data to import from citadel

    Hello,
    I use DIAdem to generate reports from Citadel and I would like to create a script which asks the user to select data and it's corresponding range to import it from citadel. The script should display a dialog box (sud dialog), the user will choose the data and the range. 
    I would like to know if a function exists because up to now, I have not found anything suitable for this.
    In my search i found this (see answer from Brad Turpin) http://forums.ni.com/ni/board/message?board.id=60&message.id=985&requireLogin=False
    But I don't know how to automatize it with sud dialog
    I am looking for information and examples on the subject.
    Thanks

    Hello,
    I changed the data base path, when I run the script an error message appeared (see attached file). When I look the dataportal files, I see that the complet data is charge and not a window (see attached file). have you any idee?
    Attachments:
    error load citadel function.pdf ‏455 KB
    view.pdf ‏279 KB

  • How can I define the position of a SUD dialog in Diadem-AUT​O?

    In the COD dialog-editor you can define the X- and Y-position of every dialog-window. In the SUD dialog-editor these options are not available. Is there any way to specify the position of a SUD dialog?

    Hi Johannes,
    There are two parameters in the dialog properties called "Top" and "Left" that seem to deterine the position of the upper left corner of the dialog on the screen.
    I have only used them in the "Preview" window of the SUD editor, but they seem to work fine.
    Let me know if this is what you were looking for.
    Otmar
    Otmar D. Foehner
    Business Development Manager
    DIAdem and Test Data Management
    National Instruments
    Austin, TX - USA
    "For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

  • Control VIEW cursor with SUD Dialog

    Hello,
    I've developed a little SUD dialog and sticked into the bottom of VIEW. I the TopArea I've "CurveChart2D".
    With the dialog I want to change the cursor type and mode (see code below)
    If I try to change the cursor from this script (the script is inside the embedded VIEW dialog I get the message of DIAdem "error"
    If I try now to change the cursor with the VIEW buttons I get the message "Schwerwiegender Fehler".
    In fact this little script crash DIAdem. I've to restart.
    If I use the Dialog standalone (not as a part of VIEW), everything works fine.
    I believe the problem is, that you can't change something from an ActiveArea (Dialog in Area : 2) inside an InactiveArea (2D Graph in Area :1)
    But this works (graph change something inside the dialog)
    Sub ViewConnector_EventCursorPosChanged(ByRef This) 'Erzeugter Event-Handler
    'todo change the label and value controls for the different cursor and trim methods
     edtXPosVal.Text = View.ActiveSheet.Cursor.X1
     edtYPosVal.Text = View.ActiveSheet.Cursor.Y1
     edtChnPos.Text =  View.ActiveSheet.Cursor.P1
    End Sub
    So the point is,
    1. how is it possible to control VIEW with an embedded SUD dialog?
    2. The script engine shouldn't crash DIAdem. It should just abort or shouldn't be executable.
    Sub Button1_EventClick(ByRef This) 'Erzeugter Event-Handler
    iTrimMethod = rdbtnTrimMethods.Value
    Dim oSheets
    Dim oChart
    oSheets = View.Sheets
    sSheetName = View.ActiveSheet.Name
            Select Case iTrimMethod
                  Case 0
                   MsgBox View.ActiveSheet.Name & " Index= " & View.ActiveSheet.Index
                     Set oChart = View.Sheets(View.ActiveSheet.Name).Areas("Area : 1").DisplayObj
                      View.Sheets(View.ActiveSheet.Name).Cursor.Type = "Crosshair"
                      View.Sheets(View.ActiveSheet.Name).Cursor.Mode = "GraphPoints"
                      View.Refresh
                  Case 1
                  MsgBox View.ActiveSheet.Name & " Index= " & View.ActiveSheet.Index
                      View.ActiveSheet.Areas(1).Active = True
                      View.Sheets(View.ActiveSheet.Name).Cursor.Type = "Band"
                      View.Sheets(View.ActiveSheet.Name).Cursor.Mode = "GraphPoints"
                      View.Refresh
                  Case 2
                  MsgBox View.ActiveSheet.Name & " Index= " & View.ActiveSheet.Index
                      View.ActiveSheet.Areas(1).Active = True
                      View.Sheets(View.ActiveSheet.Name).Cursor.Type = "Crosshair"
                      View.Sheets(View.ActiveSheet.Name).Cursor.Mode = "GraphPoints"
                      View.Refresh
            End Select
    End Sub
    Best regards
    Thomas Plöger
    BASF Catalysts Germany GmbH

    Hallo Mr. Plöger,
    I've double-checked the described behavior. In general, the script code you've developed is OK. But there was a bug in DIAdem that causes the problem. It will be fixed with the DIAdem 2010 service pack that we can provide soon.
    Greetings
    WalterRick

  • How to Start EXE-File from SUD Dialog

    Hello!
    My Problem is: I'm trying to start an exe-file by clicking a button within a SUD-Dialog. Does anybody know how to realize that?
    For example: Run("C:\Windows\Notepad.exe") ?!
    Thanks!
    Solved!
    Go to Solution.

    Thanks for you reply!
    Your code worked so far to start Notepad.exe but what I'm trying to do is to start a file, located one folder above my script folder.
    I tried the following...
    dim command : command = "Script Assistent\TSM Script Assistent.NET.exe"
    dim shell : Set shell = CreateObject("WScript.Shell")
    dim status : status = shell.Run(command, 1, true)
    If
    0 <> status ThenErr.Raise6, "", "Command returned error!"
    End If
    ...but then I receive an error message :-/
    The script and the sud-file is located in:
    G:\Script\Scriptfile.vbs + Dialogfile.sud
    The exe I'm trying to start is here:
    G:\Script\Script Assistent\TSM Script Assistent.NET.exe
    What's wrong with that?

  • Deleting multiple rows from SUD dialog table

    Hi,
    I have some SUD dialog tables that I would like to delete some rows from.  I can select and delete all or one row (using a SUD button that finds out which one row was selected or if all, and then deleting them with the table.rows.remove command), but I seem to have troubles if I want to select multiple rows (either in a range, ex: rows 3-10, or non-sequential, ex: 1, 4, 6 and 23).  I just started working on this but thought maybe someone has already done this and can save me the trouble!
    Thanks!
    Julia Moeller

    Hi Julia,
    Just a quick guess-- try looping backwards and deleting the last rows first:
    FOR i = 10 TO 3 Step -1
      table.rows.remove i
    NEXT
    Haven't tested it, so no guarantees,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Non-Modal SUD Dialog Possible?

    Is it possible to have a non-modal SUD dialog box?  I would like to use a SUD dialog box to show some things going on while a script is running, and would like it to operate much like a non-modal message box. 
    Thanks!  Julia

    Thank you for your reply, I was hoping to display a table (with changing values) or some images while scripts were executing, but I will be content with the non-modal MsgBoxDisp dialog boxes 

  • SUD-dialogs: msgbox cause a runtimeerror

    If a eventhandler of a SUD-dialog contain a msgbox command, this command cause a runtimeerror if Diadem has lost the focus. It means: the messagebox don't appear and the execution of a script is stopt.
    Steps to reproduce:
    run the example in DIAdem, after pressing 'ok' of the first Messagebox change the focus to any other windows-application, when the delay of 10s is over and the second messagebox should appear, a runtimeerror occur.
    Is it a bug or a feature of diadem?
    Is it a error of me?
    Is there a better workaround then avoiding messageboxes in dialogs?
    Bohm
    [email protected]
    Attachments:
    msgbox_test.SUD ‏2 KB

    I reproduced the Problem on my machine with DIAdem 9.1!
    I give the information to the Developers of DIAdem, maybe they can give us a workaround or a solution.
    The only possible workaround at this moment is to call the messageboxes with the timedelay out off DIAdem-Script.
    If i get another possible solution i post it here at the discussion form.
    Alex Rudolph
    National Instruments

  • Table1.Rows.Add (SUD-Dialog)

    Hallo DIAdem'ler,
    das erweitern von Tabellen (neue Zeile am Tabellenende einfügen) im SUD-Dialog mittels
      Call Table1.Rows.Add
    dauert pro Zeile ca. 0,3 Sekunden. (Intel Core2 Duo, 3GHz, 2 GB Ram, WIN XP SP3)
    Bei 600 Einträgen dauert der Vorgang ungefähr 3 Minuten. Dies nicht gerade sehr effektiv.
    Wie kann man diesen Vorgang schneller gestalten?
    Oder besser:
    Gibt es eine Methode mit der man eine Tabelle aus dem Script heraus direkt um X neue Zeilen erweitern kann?
    Vorab vielen Dank für jegliche Hilfe, frohe Weihnachten und ein guten Rutsch ins Neue Jahr
    Solved!
    Go to Solution.

    Hallo!
    Es geht einfacher als man vielleicht denkt:
    Table1.Rows.Count = Table1.Rows.Count + 600
    Das dauert bei mir dann 0.3s insgesamt.
    Frohes (Rest-)Weihnachtsfest und alles Gute für 2009
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • SUD-Dialog​e aus Diadem 9.1 in Diadem 9.0 benutzen

    Hallo,
    Ich habe einen relativ umfangreichen SUD-Dialog unter Diadem 9.1 erstellt. Nun möchte ich diesen auf einem anderen Rechner mit Diadem 9 benutzen. Das Öffnen scheitert jedoch mit einem Hinweis auf einen inkompatibeles Dateiformat. Gibt es irgendeine Möglichlichkeit, den Dialog zu konvertieren (notfalls auch mittels Hexeditor - die Dateien unterscheiden sich allerdings scheinbar nicht nur in der im Dateiheader angegebenen Diademversion...)
    Vielen Dank für die Hilfe!
    Thomas Vosshagen

    Hello!
    It is a unfulfilled desire to get a ASCII based SUD file format. Using SUD from the verry first moment this would had helped to solve a lot of problems. We are still hoping that it will by changed in the future!
    From this experience we decided to put as less code as possible into the SUD. This goal is reached by putting the code in an external script. Today (> 9.0) this script can be loaded into the SUD with the ScriptInclude command. In older version it was a little bit more complicated. In every event only a call to the external script is coded. Than you can use your prefered editor for programming and you can format the code as you like. Another advantage is that no code is lost when you delete a control. Also teamwork is much easier and source control systems can handle this files much better.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • SUD-Dialoge im XP-style ?

    Wenn ich SUD-Dialoge unter Windows XP schreibe (und ausführe), so sehen die Dialoge gar nich aus, wie Dialogefenster unter XP auszusehen haben. (Dialog-Editor ver. 9.10.2036, Windows im Thema "standard"). Insbesondere stört mich, das Buttons nur durch zwei Linien und nicht durch einen Rahmen begrenzt sind. (Die Darstellung der abgerundeten Ecken wäre mir egal.)
    Diese Tatsache verwundert mich, zumal der Dialogeditor für seine eigene Darstellung den korrekten XP-Style verwendet. Aber die fertigen Dialoge verwenden dann wohl doch nicht die entsprechenden API-calls.
    Oder bin ich in der Version des Dialogeditors nicht auf dem Laufenden ?
    Martin Bohm
    [email protected]

    Zusatz: Ein Updade auf das aktuellste Servicepack hat in diesen Punken keine Auswirkungen:
    WinXP im Style "classic": Alle Dialoge werden korrekt, wie im Style zu erwarten, dargestellt.
    WinXP im Style "Standard": Buttons werden nicht im XP-Style (mit abgerundeten Ecken) dargestellt. Sie werden auch nicht im classic-style (durch ein Rechteck mit Schatten begrenzt) dargestellt. Die Begrenzung erfolgt nur noch durch den Schatten, also nur rechts und unten. Andere Controls wie Scrollbars haben ähnliche Artefakte. Offenbar verwenden die SUD-Dialoge nicht die korrekten API-calls, die bei einem Wechsel des Styles immer zu einer korrekten Darstellung führen würden.
    Unabhängig davon gibt es erhebliche Probleme mit Diadem-DAC bei einer scriptgesteuerten Umschaltung in den Vollbildschirm, wenn der Style "Standard" gewählt ist. Ich werde darüber in einem separaten Beitrag berichten.
    Fazit: Unter WinXP sollte immer der Style "classic" gewählt werden.
    Martin Bohm
    [email protected]

  • Send data from event to SUD Dialog

    Hi,
    I have a script that trigger an event function ( OnCursorChanged)  
    and i want that each time the event is triggered ,send a string to my Dialog (contains list box of string ).
    how could i do that?  
    thanks

    Hi,
    maybe this will work, you must start your dialog non-modal and can use the CustomAction-Event in the dialog:
    Sub OnCursorChanged-SUB
    Dim myDlg
    Dim sDialogCode : sDialogCode = "theNameOfYourDialogCodeProperty"
      If Nothing is SudNonModalDlgLst(sDialogCode ) Then
        Set myDlg = SUDDlgCreate(sDialogCode , sITMPath & "test2.SUD")
        Call myDlg.Show()
      Else
        Set myDlg = SudNonModalDlgLst(sDialogCode )
      End If
      Call myDlg.RunCustomAction
    End Sub

  • Formeln erstellen/ Rückgabe der Formel nach "Calculatorstart"

    Hallo Leute,
    ich beabsichtige in einem Makro, eine Anwender-Formel auf einen Satz von Dateien anzuwenden, die nacheinander geladen werden. Der Anwender soll die Möglichkeit haben, über einen Dialog eine Formel zu erstellen, die anschließend vom Skript auf alle Dateien der Reihe nach angewendet wird.
    Mein Ansatz ist, als Formeleditor den DIAdem Formelinterpreter zu verwenden ("Call CalculatorStart()").
    Meine Fragen:
    - wie erhalte ich die erstellte Formel zurück, so dass ich sie später im Skript verwenden kann, z.B. in der Form: Call FormulaCalc(<Formeltext> )?
    - falls das nicht möglich ist: gibt es einen anderen Formeleditor, den man einsetzen könnte?
    Danke und Gruß
    Udo

    Hallo Udo,
    Leider gibt es zur Zeit keine Moeglichkeit, die im CalculatorStart() Dialog erstellte Formel programmatisch abzulesen.  Natuerlich waere dieser Dialog optimal fuer diesen Zweck, also habe ich diesen Vorschlag als gewuenschte Feature an die Entwicklung weitergegeben.  Nein, was einem uebrig bleibt, ist ein SUD-Dialog aufzustellen, wo der Benutzer die Formel ohne jegliche Hilfe als reinen Text tippen muss.  Man koennte saemtliche Hilfestellen muehsam mit SUD-Kontrollen einbauen, aber das bleibt unschoen, gerade wenn die optimale Loesung so klar vor Augen ist.
    Das tut mir leid,
    Brad Turpin
    DIAdem Product Support Engineer (USA)
    National Instruments

Maybe you are looking for

  • Safari quit unexpected

    My MacBook Pro recently suffered a set back that I have not experienced since buying it about a year ago. I work for a tourism firm and we recently needed to upgrade our security systems by installing cameras. As the Workshop Manager it was decided t

  • Adobe Media Encoder CS5.5 (5.5.1) update available

    The Adobe Media Encoder CS5.5 (5.5.1) update is available. This update fixes a few major bugs. After you've installed the update, let us know how it works for you.

  • Languages of Task  - Turkish not available

    Hi All, We are maintaining mail step in different langauges in task. But the option to maintain Turkish langauge is not appearing in the language option. I can see other languages in the task. Please let me know, what is the source of the languges, w

  • ISSUE: syncing iCal on iPhone & iPad

    I have the iPhone 4 & the newest iPad. I need to sync iCal over iCloud on these devices. Sometimes an even I enter in one iCal appears in the other device, and sometimes it doesn't. It seems very random! This causes much anxiety/frustration, as I nee

  • Using actions within masks

    Is it possible to action scale an image  while keeping it inside its mask? I have several images on a slide and I want to zoom in to one of the slides, but the mask doesn't apply to the image once it scales up. I tried selecting the scaled up image,