04-13-2010 07:19 AM
Hi,
Parameter field still editable after setting flag ‘PropFlags_NotEditable’?
I have defined a step type with a string parameter. (MyParameter). This parameter field has to contain custom generated data, stuffed from a code module.
I want to have ‘MyParameter’ read only for all instances of the step in my sequence.
I have set the property flag ‘PropFlags_NotEditable’ for ‘MyParameter’ in my step type definition, because I want to have this parameter read only in all instances.
When I try to edit ‘MyParameter’ field in an instance of the step in the sequence in the variable pane ‘Step’ - ‘MyParameter’, it still works?
What is wrong here, I suppose this should work?
Best regards
04-15-2010 07:21 AM - edited 04-15-2010 07:24 AM
Hi ccds,
The flag that you have set only prevents the user from editing the property in the step type. The user will however be able to change its value in the step type instance. I don think its possible to disable the property editing. There might be some way to disable the property browser.
Thanks,
Sathish
04-16-2010 09:37 AM
What adapter are you using?
-Doug
04-16-2010 09:55 AM - edited 04-16-2010 09:58 AM
1) Make sure you have show hidden properties turned on in the station options, preferences tab.
2) In your step type expand the variables to the place where the expression is stored for the parameter argument. In the .NET adapter this would be something like the following:TS.SData.Call.Params[0].ArgVal. Right-click on ArgVal and select the Properties menu item.
3) Click on the advanced button and select flags.
4) When the edit flags dialog pops up, click on the Type Flags button.
5) Check the PropFlags_NotEditable flag for the Instance Default Flags section. Click OK on this dialog.
6) If you want the change to effect currently open instances I think checking the "Reset Flags... " checkbox on the edit flags dialog will do this, otherwise this change will only effect new instances of your step type. Press ok on the remaining dialogs.
7) New instances will now not allow editing that value. NOTE: This only works for the sequence editor module panel though. It does not work for the dialog version used by the user-interfaces.
One thing I want to make sure you are aware of for step types is that using a default code module like this has drawbacks versus using postsubsteps. Setting the default code module doesn't keep the user from changing the specification after they insert the step, also updating existing steps if you want to change the prototype is more problematic. You might be better off with a design more like the step types that ship with teststand like the message popup step type (which also ship with source code so you can see how they are implemented) which instead use post-substeps and edit-substeps and instead designate the none adapter for the step type so that the step type can never have a code module. What they do instead is their edit substeps display a dialog that gets the settings/parameters to the operation that the step type performs and stores those as subproperties of the step. Then at runtime the post-substep gets this information and executes the necessary code. Unlike the default code module setting, changing the substeps in a step type automatically effects all existing instances of the step. Changing the code module only effects new instances, and loaded instances if you check the checkbox for that.
Hope this helps,
-Doug
04-22-2010 04:57 AM
Hi Doug,
Now, I have a steptype with an edit-substep and a post-substep, just like the message popup step that ships with teststand.
But, I think my original question was not completely clear, I will try to explain better…
Suppose I have a sequence with instances of my step type. If I click on an instance of the steptype and have a look to step parameters in the variables pane, I see all my parameters with their current value next to them. Now I want to prevent the designer of the sequence to manually edit the content of these parameters. The parameters are stuffed by executing the edit-substep and setting some controls on the graphical user interface.
So, I am looking for a method to make the value field for a each parameter in all instances of my step type read only. This should be done in the definition of the substep for the steptype.
I have done already some experiments with the flags, but up to now I do succeed in my purpose…
Best regards
04-22-2010 09:51 AM
The NotEditable flag will work for this. The tricky part though is that you don't set the flag directly on the step type's version of the properties, but instead set the Instance Default Flags on the properties as I discussed in my previous post. The reason for the separate setting is that the instances of the step can have different flag settings than the step type definition itself. In otherwords, you can have the property be editable in the step type while at the same time you can have the instance's version of the property not be editable. Basically:
1) In your step
type expand to the variables you wish to make not editable. Right-click on it and select the Properties menu item.
2) Click on the advanced button and select flags.
3) When the edit flags dialog pops up, click on the Type Flags button (i.e. don't set the flag in the regular edit flags dialog)
4) Check the PropFlags_NotEditable flag checkbox for the Instance Default Flags section.
5) Note that the Flags Not Editable in Instances section should also have the flag checked (it should already be checked by default).
6) Click the Ok button on the Type Flags dialog box, and again on the Flags dialog box and Properties dialog box.
I was incorrect in my previous post that this would only effect new instances, it actually effects all instances automatically when their types are upgraded to the new version, even if the files aren't open, which is probably what you want anyway.
Hope this helps,
-Doug
04-23-2010 01:35 AM
Thanks,
This was exactly what I am looking for...
Best regards