01-08-2019 04:42 AM
Hallo zusammen,
ich versuche etwas einfaches wie eine berechnung im Dialog.
Und das Ergebnis in einem Textfeld anzeigen lassen.
Ähnlich wie ein ganz einfacher Taschenrechner.
Mit einer globalen Variable gebe ich den Wert an das Script weiter und lasse die Berechnung laufen. Danach wird der berechnete wert in eine andere globale Variable (Ausgabewert) geschrieben.
Das funktioniert auch, weil wenn ich das Dialogfenster schließe gibt mir eine MSGBOX den richtigen berechneten Wert aus.
Wenn ich jetzt aber Ausgabewert in einem Textfeld im Dialogfenster direkt anzeigen will, zeigt es mir immer nur den wert, den die Ausgabewert Variable beim Start des Dialogfensters hatte und verändert diesen nicht, bis ich das Dialogfenster wieder schließe.
Jetzt hatte ich schon im Dialogeditor eine zusätzliche Variable erstellt, die nur den Wert der Ausgabewert Variable im Textfeld anzeigen soll.
Das ganze hat auch einmal funktioniert, aber jetzt meldet Diadem immer, dass die zusätzliche Variable nicht an Diadem übergeben wurde.
Und so bald ich diese aber im Script deklariere, wird sie im Dialogfenster nicht mehr aktualisiert.
Was mache ich falsch?
Kann mir bitte jemand helfen?
01-08-2019 05:25 AM
Hi Chris.Fydi
I assume that you do not refresh the text in the dialog box. After you set the text of the control you have to refresh it. Have a look in the help, e.g.
http://zone.ni.com/reference/en-XX/help/370858P-01/sudref/methods/sud_method_refresh_tostaticctrlrt/
Hope that helps.
Winfried
01-08-2019 06:40 AM
Hello Winfried,
I have already tried this method.
It also works, as long as you do the calculation in the script of the dialog box and then the result is displayed directly in the text box.
But as soon as you let the calculation work as a function in another script and only call the result in a global variable, the value in the dialog box remains the same. Although in the background the global variable has the changed value.
I just do not get it refreshed.
thanks for trying
Chris
01-08-2019 07:54 AM - edited 01-08-2019 07:54 AM
Hi Chris,
It would be easier to find the bug if you could post your SUD file.
If you use global variable like R1 they have to be declared in SUD. Press Ctlr + B and then OK.
I attached a small dialog box (DIAdem 2018 SUD-format as Zip file) that shows two solution. One with the global variable R1 and one with local variables. In general I would prefer the solution with local variables.
Winfried
01-09-2019 01:00 AM
okay,
maybe you can find the bug.
the Test_Dialog.VBS ist the starting script.
The rest you can see it by yourself.
I'm very interested to know the problem, because i try to make me some procedures.
So i thank you very much.