Home › Forums › Problems and solutions in GDL › Graphical UI and parameters list › Double adding to parameter
- This topic has 3 replies, 2 voices, and was last updated 7 years, 2 months ago by
Barry Kelly.
-
AuthorPosts
-
-
February 6, 2018 at 19:34 #3798
James Murray
ParticipantAn object has an optional part at the top. When the user turns the option off, I would like to automatically decrease ZZYZX by the thickness of the optional part. When they turn it on, I would like to increase ZZYZX. This works, except the optional value is added or subtracted twice. Same result in master or parameter script.
IF GLOB_MODPAR_NAME = 'bOption' & bOption THEN ZZYZX = ZZYZX + optionThk PARAMETERS ZZYZX = ZZYZX ENDIF IF GLOB_MODPAR_NAME = 'bOption' & NOT(bOption) THEN ZZYZX = ZZYZX - optionThk PARAMETERS ZZYZX = ZZYZX ENDIF
James M
-
February 7, 2018 at 03:17 #3803
Barry Kelly
ParticipantThe parameter script (or master as parameter script) will be run more than once so you need to trap it.
This should help do that.
From the GDL manual …First Occasion in Progress
n = APPLICATION_QUERY (“parameter_script”, “firstoccasion_in_progress”, isFirstRun)
This command returns whether the current run is the first run or a consequence of a previous execution of the parameter script which changed
some parameters. This command has no additional parameters.
The distinction may be important when a part of the parameter script executes a triggered event – e.g. it handles the pushing of a function button.
isFirstRun: The returned value shows whether the current run is the first runBarry.
Versions 6.5 to 22
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit -
February 7, 2018 at 19:43 #3806
James Murray
ParticipantThanks, Barry , I thought it had to do with multiple executions. Strangely, it works correctly now when placed in the Master (adding and subtracting with the checkbox), but in the Parameter script the identical code always subtracts.
rrr = APPLICATION_QUERY ("parameter_script", "firstoccasion_in_progress", isFirstRun) IF isFirstRun THEN IF GLOB_MODPAR_NAME = 'bOption' THEN IF bOption THEN ZZYZX = ZZYZX + optionThk PARAMETERS ZZYZX = ZZYZX ENDIF IF NOT(bOption) THEN ZZYZX = ZZYZX - optionThk PARAMETERS ZZYZX = ZZYZX ENDIF ENDIF ENDIF
I’m working around it by using the MS, but it is odd IMO.
James M
-
February 8, 2018 at 03:06 #3807
Barry Kelly
ParticipantAlso now in the Compatibility Options in the Details page there is an option to run the parameter script once.
I haven’t looked into this yet as I haven’t had the need.Barry.
Attachments:
Versions 6.5 to 22
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit
-
-
AuthorPosts
- The forum ‘Graphical UI and parameters list’ is closed to new topics and replies.