OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: jbuzbee on September 03, 2014, 10:15:26 AM

Title: Modal form freezes once shown - 2015
Post by: jbuzbee on September 03, 2014, 10:15:26 AM
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.
Title: Re: Modal form freezes once shown - 2015
Post by: owenwengerd on September 03, 2014, 10:41:32 AM
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.
Title: Re: Modal form freezes once shown - 2015
Post by: jbuzbee on September 03, 2014, 10:43:16 AM
Thanks Owen - you the man!  8)
Title: Re: Modal form freezes once shown - 2015
Post by: jbuzbee on September 03, 2014, 10:54:46 AM
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)
  )
Title: Re: Modal form freezes once shown - 2015
Post by: owenwengerd on September 03, 2014, 11:15:31 AM
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.
Title: Re: Modal form freezes once shown - 2015
Post by: jbuzbee on September 03, 2014, 11:26:33 AM
Got it Owen - thanks.  Boy in some ways modeless forms are easier to work with.  Of course I have more experience with modeless forms . . ..