11-15-2011 10:08 AM
Hello,
I am beginning to Use DIAdem Dialog Editor and I am wondering how I would use data that has been input in a dialog box or table cell perform some calculation on it and them display the results in another dialog box.
I would also be looking to grab data from a combo box or dialog box and and have it displayed in my final report format.
Solved! Go to Solution.
11-15-2011 02:46 PM
Hello smoothdurban,
Have you had a look at the examples included in the DIAdem Help system yet?
There is a pretty nice collection of application examples, including all the source code, in the help system:
When you click on an example, it will have a number of green links, which you can open in the DIAdem Script or dialog editor (depending on the file type) by holding the "Ctrl" key and then left clicking with the mouse ...
Let me know if that helps, and ask if you have more specific questions,
Otmar
11-16-2011 08:45 AM
Hey Otmar thanks for the tip. However it appears the first half dozen or so examples reference show "SudExample 1.sud as the dialog box file but these are not the same as the example nor do the show any event handling. I am beginning to use this tool and I am simply looking for how to capture data from text boxes or tables and process the data and display the results
I have attached a copy of my .sud file the column labeled Requested Torque has values which are currently defaulted to 200, 400, 600, 800, 1000, I wand to take these values multiplying them by the scaling factor and populate the results to the Measured torque table. The should occur when the calculate button is clicked.
The next step would be to grab say data from the combo box and pop it into my script that would call Dialog Box.
The attached files extension would need to be changed from jpg to sud.
11-16-2011 05:16 PM
Hi smoothdurban,
Here is a quick example of the beginning of what you want to do. It gets data fromthe table modifies it and puts it into another table:
I hope that this helps.
Regards,
Perry S.
11-17-2011 01:41 PM
That helps a lot! Thanks for your example.
How would you handle instances where the value in the table is not a number?
For example I have a column of 10 cells that are all to be multiplied by a variable value in a text box. I would first need to specify that the value in the text box is infact a number by casting it using INT().
The problem I have found in doing this is when I use a floating type value such as 1.5 casting the text box into INT rounds the number off.
To work around this I have cast the number using ROUND(num, 9). which gives me more then enough decimal places to work with. However the values inside column cells may all not have a numeric value and I need to determine a way that I can check whether or not these values are numeric.
I tried using the IsNumeric() function but it reckognizes all the values in the column are Strings and thus non numeric.
Kind of stuck at this point.
11-17-2011 03:26 PM
Hey
I was able to figure this out. If I check whether or not the cell location is equal to zero space.
the code looks like this
IF currentCell.Cells(i, 1).Value <> Space(0) THEN
grab the value.
The only other problem I have run into is how do I check whether or not the data input into the cell is numeric. Can I limit the iput to numberic values exclusively?
Also
Does anyone know how to open up a file broser in the Dialog box?
I basically what to give the user the ability to grab the file location in the Dialog box which would inturn pass this to DIAdem as the location of the file to open.
Any thoughts?
11-18-2011 10:48 AM
Hi smoothdurban,
I'm not sure if it's the best way to limit input information to numeric entries only, but one way that would work is to use the following line of code in the Event handler for the OnItemChange() method:
Sub Table1_OnItemChange(ByRef This, Row,Col) 'Created Event Handler IF NOT IsNumeric(This.Cells(Row,Col).Value) THEN This.Cells(Row,Col).Value = 0 End Sub
When a cell value changes, this would run and check whether or not the entry is numeric. If it isn't then the cell value would be reset to 0.
As far as launching a file selection dialog box, I recommend the following two functions:
FileNameGet()
... if you're asking the user to load a DIAdem file (data, layouts, scripts, etc)
FileDlgShow()
... if you're asking the user to select a generic file.
Let us know if you have additional questions.
11-18-2011 03:13 PM
Thanks for the tips. I have been able to use your hints to navigate and select the file I want to process.
I did have another question.
I have developed a dialog box which takes certain user input and I would like to pass the user input into another VBScript file.
This is the process that I currently have.
My main VBScript file is run and calls SUDD1gShow( ). I would assume the main script file waits until the SUDD file has completed its execution.
I want to take the user input acquired in the SUDD file and pass it to the original VBScript file that called it when a event occurs on the SUDD file such as a button being pressed.
ANy ideas on how pass reference to another program?
11-21-2011 02:10 PM
Anybody have any ides?
I am basically trying to return some values to my original script file once my SUD file has executed and closed.
To simplify it even further I am trying to return data generated by one object to another.
11-21-2011 03:05 PM
Hi smoothdurban,
One way you can transfer information back and forth is to use global variables. If you take a look at the example "Dynamic User Dialog Box" you will see that the "iMyVar2" variable is used on the initial script and the script on the back side of the dialog box.
Regards,
Perry S.