Modal form freezes once shown - 2015

Started by jbuzbee, September 03, 2014, 10:15:26 AM

Previous topic - Next topic

jbuzbee

AutoCAD 2015 The modal form won't respond to any input.  This worked in 2009

Code (autolisp) Select
;;; ;
;;; Form 01 - Save Window View ;
;;; ;
;;;pgp: kbSaveViewWindow, *kbSaveViewWindow
(defun c:Drafting_SaveView_OnInitialize (/)
    (dcl_Control_SetTitleBarIcon Drafting_SaveView 100)
    (dcl_Control_SetPicture Drafting_SaveView_SaveButton 100)
    (dcl_Control_SetMouseOverPicture Drafting_SaveView_SaveButton 100)
    )

(defun c:Drafting_SaveView_SaveButton_OnClicked (/ Value)
    (Setq Value (dcl_Control_GetText Drafting_SaveView_TextBox))
    (if Value
      (progn (dcl_form_close Drafting_SaveView)
     (command "-view" "_w" Value)
     (while (= (logand (getvar "CMDACTIVE") 1) 1) (vl-cmdf pause))

     )
      (dcl_messagebox "Enter a View Name to save" "Save View" 2 3)
      )
    )
(defun c:Drafting_SaveView_CloseButton_OnClicked (/)
  (dcl_form_close Drafting_SaveView)
)

(defun c:kbSaveViewWindow (/)
  (if (not (member "Drafting" (dcl_GetProjects)))
    (dcl_Project_load "Drafting")
    )
  (if dcl_HideErrorMsgBox
    (dcl_Form_Show Drafting_SaveView)
    (alert "The OpenDCL arx module did not load!")
    )
  (princ)
  (princ)
  )


Thank you for any help.

owenwengerd

All the command calls need to be moved out of the event handler and into the main function so that they don't get called until after the (dcl-Form-Show) returns.

jbuzbee


jbuzbee

OK - I don't understand where to put the command call???

Code (autolisp) Select
(defun c:kbSaveViewWindow (/)
  (if (not (member "Drafting" (dcl_GetProjects)))
    (dcl_Project_load "Drafting")
    )
  (if dcl_HideErrorMsgBox
    (dcl_Form_Show Drafting_SaveView)
     
    (alert "The OpenDCL arx module did not load!")
    )
  (progn(command "-view" "_w" Value)
     (while (= (logand (getvar "CMDACTIVE") 1) 1) (vl-cmdf pause))
)
  (princ)
  (princ)
  )

owenwengerd

Like this:

Code (autolisp) Select
(defun c:kbSaveViewWindow (/)
  (dcl_Project_load "Drafting")
  (if (= 123 (dcl_Form_Show Drafting_SaveView))
    (progn
      (command "-view" "_w" Value)
      (while (= (logand (getvar "CMDACTIVE") 1) 1) (vl-cmdf pause))
    )
  )
  ;(c:kbSaveViewWindow)
  (princ)
  )


Then of course you have to call (dcl-Form-Close 123) to return the value you're using to trigger the command call.

jbuzbee

Got it Owen - thanks.  Boy in some ways modeless forms are easier to work with.  Of course I have more experience with modeless forms . . ..