This could be the next step in the process of developing the Dialog interface that we want,
Or aim is to select text and return to the dialog, retaining the desired current values.
The process requires that the Dialog be hidden to allow access to the objects displayed.
There are several methodologies to achieve this goal .. here is one.
I haven't added much documentation as such, so if anyone has comments or questions, fire away.
First, the dialog :
// PeekaBoo.DCL
// codehimbelonga kwb@theSwamp
// 20060423
// Sample code to hide dialog
peekaboo : dialog {
label = "Hide Dialog Sample";
:boxed_column {
: edit_box { key = "peekaboo:text"; label = "Who dat ?";}
: button { key = "peekaboo:select"; label = "Select a Point";}
: text { value = "Selected Point :"; is_bold = true;}
: text { key = "peekaboo:point"; value = " ... ";}
}
ok_cancel;
}
Then the code :
;; // PeekaBoo.LSP
;; // codehimbelonga kwb@theSwamp
;; // 20060423
;; // Sample code to hide dialog
(DEFUN c:peekaboo (/ dcl_id
dcl_status LocalVarNames
selectedPoint
;; DCL field key values based on tag names
peekaboo:text peekaboo:point
;; Local Functions
x:SelectPoint x:saveFields
)
;| requires functions
(kb:getpoint . .)
(kb:PointToString . . .)
|;
;;
;;--------------------------
;; IS the dialog available, if so, load it and save the pointer
;;--------------------------
(IF (MINUSP (SETQ dcl_id (LOAD_DIALOG "peekaboo.DCL")))
(PROGN (ALERT "Unable to load dialog file 'peekaboo.DCL' ") (EXIT))
)
;;--------------------------------------------------------------
;; local function to select point
;;--------------------------------------------------------------
;;
(DEFUN x:SelectPoint ()
(SETQ selectedPoint (kb:getpoint nil
selectedPoint
(+ 1 8)
nil
selectedPoint
)
)
(IF selectedPoint
(SETQ peekaboo:point (VL-PRIN1-TO-STRING previousPoint))
)
)
;;--------------------------------------------------------------
;; local function to save the dcl field values
;;--------------------------------------------------------------
;;
(DEFUN x:saveFields (/)
(MAPCAR '(LAMBDA (field) (SET (READ field) (GET_TILE field)))
LocalVarNames
)
)
;;--------------------------------------------------------------
;; local function to restore the dcl field values
;;--------------------------------------------------------------
;;
(DEFUN x:restoreFields ()
(MAPCAR '(LAMBDA (field)
(IF (SETQ tmp (EVAL (READ field)))
(SET_TILE field tmp)
)
)
LocalVarNames
)
)
;;--------------------------------------------------------------
;;
;;--------------------------
;; set environment
;; set status higher than any expected DONE_DIALOG value
;;--------------------------
;;
(SETQ LocalVarNames '("peekaboo:text" "peekaboo:point")
dcl_status 10
)
;;--------------------------
;; begin a loop until DONE_DIALOG accept or cancel
;;--------------------------
;;
(WHILE (> dcl_status 1)
;;--------------------------
;; make sure the form is defined
;;--------------------------
;;
(IF (NOT (NEW_DIALOG "peekaboo" dcl_id))
(EXIT)
)
;; so proceed ..
;;--------------------------
;; initialise the action_tiles
;;--------------------------
;;
(x:restoreFields)
(ACTION_TILE "peekaboo:select" "(x:saveFields)(DONE_DIALOG 9)")
;;--------------------------
;; activate the dialog
;;--------------------------
;;
(SETQ dcl_status (START_DIALOG))
;;--------------------------
;; if we are here, the dialog has been removed from the screen
;; following either :
;; (DONE_DIALOG 0) Cancel
;; (DONE_DIALOG 1) OK
;; (DONE_DIALOG 9) "select"
;;--------------------------
;;
(COND ((= dcl_status 0) (ALERT "ZERO "))
((= dcl_status 1) (ALERT "ONE "))
((= dcl_status 9) (x:SelectPoint))
)
)
(UNLOAD_DIALOG dcl_id)
(PRINC)
)
and a Piccy