How establishes the show to "textbox"

Started by JTHWAMAN, December 25, 2007, 08:18:50 AM

Previous topic - Next topic

JTHWAMAN

I want "textbox", may input and pick up text.
Asked how should establish ?
Requests master help to answer, thanks ~


QTEST.lsp code:
(DCL_LOADPROJECT "ODLS_006.odcl" T)
(dcl_FORM_SHOW ODLS_006_TS)

(if (/= sText "")
(dcl_Control_SetText ODLS_006_TS_TBX sText)
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(defun GET_TEXT ( / EN EN_TXT)
(SETQ EN (CAR (ENTSEL "\n[GET] SELECT TEXT :")))
(SETQ EN_TXT (CDR (ASSOC 1 (ENTGET EN))))
EN_TXT
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(defun PUT_TEXT ( EN_TXT / EN OLD_TS)
(SETQ EN (CAR (ENTSEL "\n[PUT] SELECT TEXT :")))
(setq endata  (entget en))
(setq oldlist (assoc 1 endata))
(setq newlist (cons 1 EN_TXT))
(setq endata  (subst newlist oldlist endata))
(entmod endata)
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(defun c:ODLS_006_TS_TBN1_OnClicked ( / )
(SETQ GTX (GET_TEXT))
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(defun c:ODLS_006_TS_TBN2_OnClicked ( / )
(PUT_TEXT GTX)
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(defun c:ODLS_006_TS_TBX_OnUpdate (GTX /)
(if (/= GTX "")
  (progn
   (setq sText GTX)
   (setq GTX "")
   (dcl_control_settext ODLS_006_TS_TBX sText)
   ) ;_ PROGN
  ) ;_ if
) ;_ defun

[attachment deleted by admin]

Kerry

Welcome to the forum.

Looks like you need an initialize event ..
and the OnUpdate code doesn't look correct.
I'll have a look after I have my morning coffee.



Perfection is not optional.
My other home is TheSwamp

Kerry

#2
I've made some changes.
// odcl
1) removed ALL the Event notification from the Textbox in the ODCL.
2) added an onInitialize Event to set the initial values when the form loads.
3) Changed Textbox LimitText property from 1 to 100
4) Changed Textbox ReturnAsTab property to true.

// lsp

added a command line defun c:qtest (...
added c:ODLS_006_TS_OnInitialize (...
changed sText variable name to global:sText
changed test logic to test for nil global:sText value.
changed the local function names to _GET_TEXT and _PUT_TEXT ; ( personal preference only)
forced the local functions to the defined locally, NOT globally.


(DEFUN c:qtest (/
                ;;
                _GET_TEXT _PUT_TEXT
               )
;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    (DEFUN _GET_TEXT (/ EN EN_TXT)
        (IF (SETQ EN (CAR (ENTSEL "\n[GET] SELECT TEXT :")))
            (SETQ EN_TXT (CDR (ASSOC 1 (ENTGET EN))))
        )
    )
;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    (DEFUN _PUT_TEXT (EN_TXT / EN ENDATA NEWLIST OLDLIST)
        (IF (SETQ EN (CAR (ENTSEL "\n[PUT] SELECT TEXT :")))
            (PROGN (SETQ endata  (ENTGET en)
                         oldlist (ASSOC 1 endata)
                         newlist (CONS 1 EN_TXT)
                         endata  (SUBST newlist oldlist endata)
                   )
                   (ENTMOD endata)
            )
        )
        (PRINC)
    )
;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    (DCL_LOADPROJECT "ODLS_006.odcl" T)
    (DCL_FORM_SHOW ODLS_006_TS)
    (PRINC)
)
;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(DEFUN c:ODLS_006_TS_OnInitialize (/)
    (IF (AND global:sText (/= global:sText ""))
        (DCL_CONTROL_SETTEXT ODLS_006_TS_TBX global:sText)
    )
    (PRINC)
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(DEFUN c:ODLS_006_TS_TBN1_OnClicked (/ GTX)
    (SETQ GTX (_GET_TEXT))
    (IF (AND GTX (/= GTX ""))
        (PROGN (SETQ global:sText GTX)
               (DCL_CONTROL_SETTEXT ODLS_006_TS_TBX global:sText)
        )
    )
    (PRINC)
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(DEFUN c:ODLS_006_TS_TBN2_OnClicked (/)
    (_PUT_TEXT (DCL_CONTROL_GETTEXT ODLS_006_TS_TBX))
    (PRINC)
)

;;;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


[attachment deleted by admin]
Perfection is not optional.
My other home is TheSwamp


Kerry

You're welcome. I'm happy it worked as required.
Perfection is not optional.
My other home is TheSwamp