OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: krunch on February 14, 2011, 06:34:22 AM

Title: How to position a form without opening it ?
Post by: krunch on February 14, 2011, 06:34:22 AM
Hi

I'd want a Modeless form to appear near the cursor, so I set the position (left height) of the form with SetPos method (lisp below).
But this method doesn't work if the form is not displayed, so it makes a "flash" on the previous position of the form when (dcl_Form_Show proj dia) is called.

Is there a way to set position before the dcl_Form_Show ?
Thanks

Code (autolisp) Select

    (dcl_Form_Show proj dia)
;;;    (dcl_Form_Hide proj dia T) ; doesn't change anything
    (MoveForm dia 216 232) ; width height of the form
;;;    (dcl_Form_Hide proj dia nil)

(defun MoveForm (dia x y / tmp lft hgt)
  (setq tmp (dcl_GetMouseCoords)
    lft (if (< (- (car(dcl_GetScreenSize)) (car tmp) 30) x) (- (car tmp) x 30) (+ (car tmp) 30))
    hgt (if (< (- (last tmp) 30) y) (+ (last tmp) 30) (- (last tmp) y 30)))
  (dcl_Control_SetPos proj dia lft hgt)
)
Title: Re: How to position a form without opening it ?
Post by: Fred Tomke on February 14, 2011, 07:38:59 AM
Hello, why don't you use (dcl_form_show proj_dia intX intY) ?

Fred
Title: Re: How to position a form without opening it ?
Post by: krunch on February 14, 2011, 09:02:30 AM
I had't seen these arguments for show method.. Thanks !
Title: Re: How to position a form without opening it ?
Post by: Fred Tomke on February 14, 2011, 11:38:53 AM
You're welcome!  :)

Fred