Okay, I'll agree: that was complicated and the approach was bad - so heres a substitute:
; Extracts the specified attribute tile's values from a DCL code, which written as a list of strings
; NOTE: the routine won't avoid any DCL comments, so don't comment attributes like // key = \"case\";
(defun DCLstring
->atttvals
( attt dclcode
/ rgx r
) (lambda ( / stringp mc2 L tmp
) (
nil
)
)
(
); foreach
); progn
)
); cond
); lambda
); function
); vl-catch-all-apply
); defun DCLstring->atttvals
So given:
'(
" TextTest : dialog // The folowing dialog utilises 1 toggle, 1 image_button, 2 radio_button(s), 1 edit_box"
" { label = \"Edit Text\"; spacer;"
" : row"
" { : toggle { label = \"UPPERCASE\"; key = \"case\"; alignment = left; value = 1; }"
" : image_button { key = \"SelButton\"; width = 5; color = 1; } // this color must turn to green when selection is made"
" : text { label = \"< Select object(s)\"; key = \"SelPrompt\"; fixed_width = true; }"
" }"
" : boxed_radio_row"
" { label = \"Layer options\";"
" : radio_button { label = \"Change to Current\"; key = \"CtC\"; value = 1; }"
" : radio_button { label = \"Keep Original\"; key = \"KO\"; }"
" }"
" : edit_box { label = \"Text\"; key=\"Text\"; value = \"Sample Text\"; width = 12; }"
" spacer; ok_cancel;"
" }"
)
)
then:
_$ (DCLstring->atttvals "key" dclcode) >> ("case" "SelButton" "SelPrompt" "CtC" "KO" "Text")
_$ (DCLstring->atttvals "label" dclcode) >> ("Edit Text" "UPPERCASE" "< Select object(s)" "Layer options" "Change to Current" "Keep Original" "Text")
_$ (DCLstring->atttvals "value" dclcode) >> (1 1 "Sample Text")
_$ (DCLstring->atttvals "width" dclcode) >> (5 12)
Now you might ask me where do I use this:
Usually when I'm writing dialogs that use array of tiles, and also generating a set of keys - I often need to construct a list of these keys in order to set default actions.
Previously I was collecting them, while assembling the DCL-code list of strings. Or in other cases I'm just lazy to manually write them.
Well if you have seen some DCL codes I posted previously you'll understand (although I'm not ready yet to provide a pracitcal example with that subfoo [laziness reasons]).
Thank you for your attention and happy holidays!
