+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Full Member
    Using
    not specified
    Join Date
    Mar 2005
    Posts
    53

    Default DCL Box Placement

    Registered forum members do not see this ad.

    Hi,

    I need to move a DCL box out of the middle of the screen, is there a way to do that?

    Thanks for your help.
    Shawndoe

  2. #2
    Senior Member kruuger's Avatar
    Computer Details
    kruuger's Computer Details
    Operating System:
    Xp 64bit
    Using
    AutoCAD 2010
    Join Date
    Dec 2007
    Location
    Poland
    Posts
    193

    Default

    do you want to save dialog position after close ?
    look at this code:
    http://www.cadtutor.net/forum/showth...ne-can-test-it
    and
    http://www.cadtutor.net/forum/showth...indow-position

    kruuger

  3. #3
    Full Member
    Using
    not specified
    Join Date
    Mar 2005
    Posts
    53

    Default

    Hi,

    That did it thanks alot.

    Have a good one.
    Shawndoe

  4. #4
    Senior Member
    Computer Details
    Snownut's Computer Details
    Operating System:
    Windows 7 Home premium
    Computer:
    Lenovo
    Using
    Architecture 2011
    Join Date
    Nov 2010
    Location
    New Hampshire
    Posts
    233

    Default

    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....

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,915

    Default

    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
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,915

    Default

    Ok, so I couldn't resist making an example

    Code:
    (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:

    Code:
    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
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,915

    Default

    Registered forum members do not see this ad.

    In fact, I have just decided to add this topic to my website:

    http://lee-mac.com/dialogposition.html
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Interior wall placement
    By cotts135 in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 29th Jan 2010, 05:40 pm
  2. object placement within CAD
    By NeonFireLights in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 17th Dec 2009, 04:02 pm
  3. Part Placement 2
    By Laurel in forum Autodesk Inventor
    Replies: 7
    Last Post: 6th Aug 2009, 08:30 am
  4. Part Placement
    By Laurel in forum Autodesk Inventor
    Replies: 3
    Last Post: 2nd Aug 2009, 02:54 pm
  5. Hole Placement
    By kam3 in forum Autodesk Inventor
    Replies: 5
    Last Post: 6th Nov 2008, 12:40 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts