PDA

View Full Version : Mutually-exclusive variables problem...


coroto
10-06-2005, 06:50 PM
Hello,


I have an issue with the behavior of some supposedly mutually-exclusive variables in an sd-defdialog (OSDM 13.20A). In the attached lisp file, I have defined a very simple dialog which does not behave as I expect.


The problem is that the :mutual-exclusion status of the 3 boolean variables A_PART, B_PART and C_PART is not respected when the value of the Boolean is set by the code rather than the person clicking the mouse.


I would expect that after the user types in a value for Name No. 1 that the “A Type” button would be ON and the other two of the mutually-exclusive set would be turned off. Apparently, the (sd-set-variable-status ‘a_part :value t) does NOT behave the same as if a person clicked the Type A button in the dialog.


I used sd-set-variable-status instead of setq because it’s supposed to be more complete in doing the right things (like using the :check-function if any and also executing the :after-input code). I would expect the behavior with sd-set-variable-status setting the value to be equivalent to a user poking the button.


What use is the :mutual-exclusion if it only works with user clicks? I would have to manage the on/off states manually in the after-input code of each.


Please have a look at this and let me know if this appears to be a defect, or whether I just don’t understand the “correct” behavior, or what….

Andy Poulsen
10-06-2005, 09:42 PM
Hi Coroto,

I agree that it's puzzling why it works (or doesn't work) this way -- the documentation surely seems to indicate that the "sd-set-variable-status" should handle everything properly, but it clearly doesn't.

However, for this type of situation there is a fairly easy workaround (at least in many cases) to more accurately simulate user input. If you use the "sd-put-buffer <your command>" command, it will be as though the user had typed the <your command> code directly into the user input line, which you can use to your advantage.

For example, if you want to select a variable (such as a_part) from the user input line, you can just prefix the variable name with a colon i.e. ":a_part" (without the quotes, of course). In addition, if you follow the variable name with its new value, you can set the value of that variable. For example, if you replace the line :after-input (sd-set-variable-status 'a_part :value t)with :after-input (sd-put-buffer ":a_part :ON")it will behave as if the user clicked on the a_part variable (actually you don't need the ":ON" in this case since it's a mutual-exclusion variable, but you would need to use ":ON" or ":OFF" with a regular boolean variable).

Does this make sense or help at all? Please let me know if this is not clear, or if you need something else.

Good luck!

coroto
10-07-2005, 07:22 AM
Excellent suggestion on the sd-put-buffer. I usually try to avoid bypass solutions like that in general, but sometimes it's just how you have to go to make things work the way you want.

That's what I love about this forum, I can almost always find someone to suggest a useful alternative whenever I get in a bind.

Thanks!

Ultimately, though, I think I'd still like to see the (sd-set-variable-status 'variable :value t) fixed/improved...

coroto
10-07-2005, 01:14 PM
Well, it looks like CoCreate Support agreed with our contention that it ought to be fixed.

Defect BQJNST1E2T3KQY is the name to track it with.

Andy Poulsen
10-07-2005, 01:16 PM
Excellent news! Thanks for the update!