) (05/04/90)
Notes on using margin-choices with w:choose-variable-values. I have been plagued by this problem for years, and it still isn't quite perfect yet. On the other hand, it's a lot better than it was. The problem: margin-choices don't behave as called out in the manual. Well, they do behave correctly, if you know the syntax, but the book doesn't give the correct syntax. The correct syntax is: '((display-string form-to-eval :documentation "doc-string") ... ) the display-string is the name you'll see. the form-to-eval is what to do if this box is clicked. if the form is () nothing gets done and the call returns. if it's not (), it is evaluated, and if the result is non-NIL, the call returns; if it returns (), the window stays up allowing further work. there are some other aspects, but they're internally defaulted (like already having the choice-box checked). there may be more which I haven't figured out yet. the unfortunate thing is that there's no way for your form-to-eval to forcibly update the window. it isn't difficult to do, but you have no easily-accessible pointer to the window (not even SELF). the way you would do it if you could: '(("Click Me" (SEND self :redisplay-variable 'name-from-var-list) :documentation ...) ... ) this way, if you clicked a choice box, you could cause one or more variables to get changed and see the result immediately. I guess the idea is that you don't do this. unfortunately, that's exactly what I wanted to do, years ago. so I wrote my own version of CVV which let me do it (as well as fixing numerous other CVV bugs which have since been cleared up); I specifically bound SELF to the window. otherwise, you want to build your own flavor, etc. ------- the internal syntax of margin choices is also different from the book. the internal syntax, for doing your own flavor, is: ((name box-checked-p tv:choose-variable-values-choice-box-handler ;or your own fn? () () ;don't know what these do. :documentation "doc-string" form-to-eval) ...) it's order-specific. this is what w:choose-variable-values sets up internally. apparently you can substitute something of your own for the ...-handler fn. it takes three args; pretty trivial, really. I couldn't see a reason for doing it differently. anyway, this should help you do fancier things.