Hi, DCL Dudes and Dudettes!
Recently Lee Mac wrote some nice DCL example and I was impressed by some fragment of it:
(set_tile "error" "Please enter a positive numerical length.") )
(set_tile "error" "Please enter a positive numerical width.") )
)
)
)
So I thought for a lazy'er way to write dialogs on the fly.
Its not that effective as the existing on-the-fly methods, due some restrictions that cause risk of semantic errors. But I just wanted to leave it as an idea/option:
; Remarks:
; DO NOT USE ":" inside the keys/labels strings
; @ are substituted with ; (semicolons) inside the string, since they can be recognized in the .lsp code
; everything in the DCL code (keys/labels) is re-written in lowercase
; Returns the DCL ID if successful, else nil
(defun LoadDialogOnTheFly
( dcl LstDCL
/ *error* opn dch
) (
LstDCL
)
)
)
)
)
)
)
opn
)
)
)
); defun LoadDialogOnTheFly
Heres an usage example:
; Test function for (LoadDialogOnTheFly)
(defun c:test
( / *error* dcl dch des txt dlgRtn
) '( ( m )
)
)
(LoadDialogOnTheFly dcl
'( ; @ will be substituted with ";" - obviously, and everything in the code is written lowercase, because it will be converted to lwcase anyway
test : dialog
{ label = "edit text" @ initial_focus = "edit1" @ spacer @ ; separate the @ from other strings (esp from numbers) with space
: row
{
: column
{ width = 5.09 @ fixed_width = true @ spacer @
: text
{ key = "prompt" @ label = "type text" @ }
}
: edit_box
{ key = "edit1" @ edit_width = 26.42 @ fixed_width = true @ }
}
spacer @
: row
{ fixed_width = true @ alignment = centered @
: ok_button
{ key = "ok-key" @ width = 11 @ }
: cancel_button
{ key = "cancel-key" @ width = 11 @ }
}
}
)
); LoadDialogOnTheFly
); setq dch
(setq txt
"Type text here") )
); and
); defun C:test for (LoadDialogOnTheFly)