Jump to content

DCL Box Placement


Shawndoe

Recommended Posts

  • 1 month later...

I have looked at this thread, and the file from kruuger, however I am still lost on dcl box placement. Is there a way to direct the where the dialog box is placed on the screen when it opens ? Anyone willing to share....

Link to comment
Share on other sites

You can specify an initial position in screen coordinates, then the position of the dialog will be returned bythe done_dialog function, which you can store for the next time.

 

I'll post an example if you wish :)

Link to comment
Share on other sites

Ok, so I couldn't resist making an example :D

 

(defun c:test ( / *error* dcl dch )

 ;; Example by Lee Mac 2011  -  www.lee-mac.com
 
 ;; Demonstrates how to remember a dialog screen
 ;; position for next use.

 ;; Requires accompanying file: test.dcl to be
 ;; in AutoCAD Support Path.

 (defun *error* ( msg )
   (if dch (unload_dialog dch))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
 )

 (cond
   (
     (not
       (and
         (setq dcl (findfile "test.dcl"))
         (< 0 (setq dch (load_dialog dcl)))
       )
     )

     (princ "\n** DCL File not found **")
   )
   (
     (not (new_dialog "test" dch "" (cond ( *screenpoint* ) ( '(-1 -1) ))))
                                            
     (setq dch (unload_dialog dch))
     (princ "\n** Dialog could not be Loaded **")
   )
   (t
     (action_tile "accept" "(setq *screenpoint* (done_dialog 1))")
     (start_dialog)

     (setq dch (unload_dialog dch))
   )
 )

 (princ)
)

 

Save the following as 'test.dcl' in a Support Path:

 

test : dialog { label = "Test Dialog";
 spacer;
 : text { label = "Move me"; alignment = centered; }
 spacer;
 : button { key = "accept"; is_default = true; label = "I'm Done"; }
}

 

Position is stored as a global variable in this case, but the code could be altered to convert the screen position into a string and store it in the registry between drawing sessions.

 

Enjoy!

 

Lee

Link to comment
Share on other sites

  • 4 years later...

Snownut,

 

You would need to set *dlgpos* as a list of 2 integers, defining position of upper left corner of your DCL.

 

So you would need to (getvar 'screensize) and know the pixel size of your dcl.

 

(setq *dlgpos* '(0 0)) would place it at upper left corner of Autocad Screen,

overlapping the ribbon. For that case no need to know thw size of the box.

 

ymg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...