Name in modal form

Started by csgoh, April 16, 2009, 11:22:22 PM

Previous topic - Next topic

csgoh

Greetings to all.
I am new to this forum and also trying to learn openDCL.
My first attempt really puzzles me and hope to get some help.
I am using acad map 2004 and ver 5.0.0.25 opendcl.
In my odcl file, the name of my modal form is TESTING and correspondingly in the lsp file also TESTING.
This works out as expected. see p1.jpg

Code (autolisp) Select

(defun c:TET (/
                c:W3_TESTING_Cancel_OnClicked
                c:W3_TESTING_OnInitialize
                c:W3_TESTING_OK_OnClicked
                c:W3_TESTING_SKALA_OnEditChanged
               )
   (defun c:W3_TESTING_OnInitialize ()
     (dcl_Control_SetText W3_TESTING_SKALA
        (cdr (assoc "SKALA" wg:constant-list)) )
   )

   (defun c:W3_TESTING_Cancel_OnClicked ()
     (dcl_Form_Close W3_TESTING)
   )

   (defun c:W3_TESTING_OK_OnClicked ()
;; update wg:constant-list
   (if (<= (atoi (dcl_control_gettext W3_TESTING_skala)) 0)
    (progn
     (dcl_MessageBox "SCALE > 0")   
    )
    (progn
     (setq wg:constant-list
        (subst (cons "SKALA" (ATOI (dcl_control_gettext W3_TESTING_skala)))
               (assoc "SKALA" wg:constant-list)
               wg:constant-list
        )
     )
     (dcl_Form_Close W3_TESTING)
    )
   );if
   )

   (defun c:W3_TESTING_SKALA_OnEditChanged (sText /)
(print "stext ")(print stext)
     (setq svariable sText)
(print "svariable ")(print svariable)
   )

  (or LoadRunTime (load "_OpenDclUtils.lsp") (exit))
  (LoadRunTime)
  (LoadODCLProj "W3.odcl")
  (dcl_FORM_SHOW W3_TESTING)

;; The Event handlers manage the form here.   
  (PRINC)
(print "wg:constant-list ")
(print wg:constant-list)
)

Then I change the name of the modal form to TESTING1 or some other name and also change it in the lsp file. However this does not work out. see p2.jpg
Where have I gone wrong??

Code (autolisp) Select

(defun c:TET (/
                c:W3_TESTING1_Cancel_OnClicked
                c:W3_TESTING1_OnInitialize
                c:W3_TESTING1_OK_OnClicked
                c:W3_TESTING1_SKALA_OnEditChanged
               )
   (defun c:W3_TESTING1_OnInitialize ()
     (dcl_Control_SetText W3_TESTING1_SKALA
        (cdr (assoc "SKALA" wg:constant-list)) )
   )

   (defun c:W3_TESTING1_Cancel_OnClicked ()
     (dcl_Form_Close W3_TESTING1)
   )

   (defun c:W3_TESTING1_OK_OnClicked ()
;; update wg:constant-list
   (if (<= (atoi (dcl_control_gettext W3_TESTING1_skala)) 0)
    (progn
     (dcl_MessageBox "SCALE > 0")   
    )
    (progn
     (setq wg:constant-list
        (subst (cons "SKALA" (ATOI (dcl_control_gettext W3_TESTING1_skala)))
               (assoc "SKALA" wg:constant-list)
               wg:constant-list
        )
     )
     (dcl_Form_Close W3_TESTING1)
    )
   );if
   )

   (defun c:W3_TESTING1_SKALA_OnEditChanged (sText /)
(print "stext ")(print stext)
     (setq svariable sText)
(print "svariable ")(print svariable)
   )

  (or LoadRunTime (load "_OpenDclUtils.lsp") (exit))
  (LoadRunTime)
  (LoadODCLProj "W3.odcl")
  (dcl_FORM_SHOW W3_TESTING1)

;; The Event handlers manage the form here.   
  (PRINC)
(print "wg:constant-list ")
(print wg:constant-list)
)



BazzaCAD

have a look at your events tab. it will still have the old name in there. uncheck it and recheck to get the new name.
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

csgoh

uncheck and the recheck the  initialize checkbox. but there is no name checkbox. still doesnt work.

owenwengerd

Renaming a form does not automatically rename event handler functions. Just copy and paste event handler function names for each event from the window at the bottom of the event tab, that way your lisp function names will match the ODCL project file. Also, you should use (dcl_Project_Load "<project-filename>" T) to load your project file.
Owen Wengerd (Outside The Box) / ManuSoft

BazzaCAD

Select your accept button & go to the events tab for it. Uncheck & recheck the OnClick event for it. Do the same for the ignore button & your text box OnEditChanged.
Just fixing the OnInitialize wont work as your other control will still have the old names....
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

csgoh

ok that fix the problem. thanks.