Author Topic: Is that possible to Create a "modeless" DCL?  (Read 3719 times)

0 Members and 1 Guest are viewing this topic.

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Is that possible to Create a "modeless" DCL?
« on: March 01, 2011, 06:29:22 AM »
Can I leave DCL(don't close it),then run commands or do other things in CAD? I mean,to create a DCL like a toolbar.when I click some buttons on this DCL, then run the function defined by DCL,After it lost focus, I can run CAD commands.
« Last Edit: March 01, 2011, 10:53:49 PM by highflybird »
I am a bilingualist,Chinese and Chinglish.

pkohut

  • Bull Frog
  • Posts: 483
Re: Is that possible for DCL?
« Reply #1 on: March 01, 2011, 07:32:51 AM »
It's called a "modeless" dialog, the other type is "modal". Yes, you can create a modeless dialog with opendcl.
New tread (not retired) - public repo at https://github.com/pkohut

Chris

  • Swamp Rat
  • Posts: 548
Re: Is that possible for DCL?
« Reply #2 on: March 01, 2011, 09:04:10 AM »
It's called a "modeless" dialog, the other type is "modal". Yes, you can create a modeless dialog with opendcl.
but you would have to download the software, and make sure that everyone that uses your dialog has the runtime extension for it.  I downloaded opendcl studio, one day I might actually get around to learning how to use it.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: Is that possible for DCL?
« Reply #3 on: March 01, 2011, 09:32:08 AM »
Yes,OpenDCL,VBA ,ARC  can get it.but for DCL, it's difficult.
I am a bilingualist,Chinese and Chinglish.

efernal

  • Bull Frog
  • Posts: 206
Re: Is that possible for DCL?
« Reply #4 on: March 01, 2011, 10:30:54 AM »
;; use this template

(DEFUN c:test (/ dcl_id what_next)
  (IF (> (SETQ dcl_id (LOAD_DIALOG "YourDclFileHere.dcl")) 0)
    (PROGN (SETQ what_next 10)
           (WHILE (> what_next 1)
             (NEW_DIALOG "YourDclDefinitionHere" dcl_id)
             (ACTION_TILE "button_1" "(DONE_DIALOG 2)")
             (ACTION_TILE "button_2" "(DONE_DIALOG 3)")
             ;; more options here...
             (ACTION_TILE "cancel" "(DONE_DIALOG 0)")
             (ACTION_TILE "end" "(DONE_DIALOG 1)")
             (SETQ what_next (START_DIALOG))
             (COND ((= what_next 0) (PRINC "\n-> Cancel button was pressed..."))
                   ((= what_next 1) (PRINC "\n-> Close button was pressed..."))
                   ((= what_next 2) (ALERT "Run a function here..."))
                   ((= what_next 3) (ALERT "Run another function here..."))
                   ;; and so on...
             )
           )
           (UNLOAD_DIALOG dcl_id)
    )
    (PRINC "\nRequired dcl file not found...")
  )
  (PRINC)
)
e.fernal

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: Is that possible for DCL?
« Reply #5 on: March 01, 2011, 10:50:26 PM »
;; use this template

Thanks for your good code.
but in this template,you can't run CAD commands until leave it.so it's not my meaning.
Thank you any way.
pkohut is right, I want a modeless dialog, a modeless DCL.
I am a bilingualist,Chinese and Chinglish.

Sam

  • Bull Frog
  • Posts: 201
Re: Is that possible to Create a "modeless" DCL?
« Reply #6 on: March 02, 2011, 03:35:42 AM »
Can I leave DCL(don't close it),then run commands or do other things in CAD? I mean,to create a DCL like a toolbar.when I click some buttons on this DCL, then run the function defined by DCL,After it lost focus, I can run CAD commands.
Dear Sir,
this code copy www.mjtd.com
Code: [Select]
(defun C:test( / id i ok)
  (setq id (load_dialog "star test.DCL")) ;load DCL
  (if (new_dialog "dcl_test" id)
    (progn
      (setq i 1)
      (repeat 6
        (init_image i) ;assign an action to the image_button
;(action_image i)
(setq i (1+ I))
      )
      (action_tile "C1" "(action_command 1)") ;assign an action to the button 1
      (action_tile "C2" "(action_command 2)") ;assign an action to the button 2
      (action_tile "C3" "(action_command 3)") ;assign an action to the button 3
      (action_tile "C4" "(action_command 4)") ;assign an action to the button 4
      (action_tile "C5" "(action_command 5)") ;assign an action to the button 5
      (action_tile "C6" "(action_command 6)") ;assign an action to the button 6

      ;;of course ,you can do it by (repeat)
      (setq ok (start_dialog))
    )
    (alert "Can't load the dialoag!")
  )
  (unload_dialog ID)
  (princ)
)

;;; initializate the image_button.
;;; and assign an action to an image_button
(defun init_image (key / k tile)
  (setq k (itoa key))
  (setq tile  (strcat "I" k)) ;tile
  (start_image tile)
  (fill_image
    0
    0
    (dimx_tile tile)
    (dimy_tile tile)
    key
  )
  (end_image) ;fill tile with different color
  (set_tile tile (strcat "Fun" k)) ;set the text of tile
  (action_tile tile (strcat "(action_command " k ")")) ;action
)

;;; assign an action to an command_button
(defun action_command (key)
  (cond
    ((= key 1)
     (alert "Please enter  your command1:")
     ;;add your code in here
    )
    ((= key 2)
     (alert "Please enter  your command2:")
     ;;add your code in here
    )
    ((= key 3)
     (alert "Please enter  your command3:")
     ;;add your code in here
    )
    ((= key 4)
     (alert "Please enter  your command4:")
     ;;add your code in here
    )
    ((= key 5)
     (alert "Please enter  your command5:")
     ;;add your code in here
    )
    ((= key 6)
     (alert "Please enter  your command6:")
     ;;add your code in here
    )
  )
)
« Last Edit: March 02, 2011, 03:49:31 AM by Sam »
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

highflyingbird

  • Bull Frog
  • Posts: 415
  • Later equals never.
Re: Is that possible to Create a "modeless" DCL?
« Reply #7 on: March 02, 2011, 03:47:26 AM »
Can I leave DCL(don't close it),then run commands or do other things in CAD? I mean,to create a DCL like a toolbar.when I click some buttons on this DCL, then run the function defined by DCL,After it lost focus, I can run CAD commands.
Dear Sir,
I thing u find this type tool, this code copy www.mjtd.com
Code: [Select]
(defun C:test( / id i ok)
  (setq id (load_dialog "star test.DCL")) ;load DCL
  (if (new_dialog "dcl_test" id)
    (progn
      (setq i 1)
      (repeat 6
        (init_image i) ;assign an action to the image_button
;(action_image i)
(setq i (1+ I))
      )
      (action_tile "C1" "(action_command 1)") ;assign an action to the button 1
      (action_tile "C2" "(action_command 2)") ;assign an action to the button 2
      (action_tile "C3" "(action_command 3)") ;assign an action to the button 3
      (action_tile "C4" "(action_command 4)") ;assign an action to the button 4
      (action_tile "C5" "(action_command 5)") ;assign an action to the button 5
      (action_tile "C6" "(action_command 6)") ;assign an action to the button 6

      ;;of course ,you can do it by (repeat)
      (setq ok (start_dialog))
    )
    (alert "Can't load the dialoag!")
  )
  (unload_dialog ID)
  (princ)
)

;;; initializate the image_button.
;;; and assign an action to an image_button
(defun init_image (key / k tile)
  (setq k (itoa key))
  (setq tile  (strcat "I" k)) ;tile
  (start_image tile)
  (fill_image
    0
    0
    (dimx_tile tile)
    (dimy_tile tile)
    key
  )
  (end_image) ;fill tile with different color
  (set_tile tile (strcat "Fun" k)) ;set the text of tile
  (action_tile tile (strcat "(action_command " k ")")) ;action
)

;;; assign an action to an command_button
(defun action_command (key)
  (cond
    ((= key 1)
     (alert "Please enter  your command1:")
     ;;add your code in here
    )
    ((= key 2)
     (alert "Please enter  your command2:")
     ;;add your code in here
    )
    ((= key 3)
     (alert "Please enter  your command3:")
     ;;add your code in here
    )
    ((= key 4)
     (alert "Please enter  your command4:")
     ;;add your code in here
    )
    ((= key 5)
     (alert "Please enter  your command5:")
     ;;add your code in here
    )
    ((= key 6)
     (alert "Please enter  your command6:")
     ;;add your code in here
    )
  )
)
:-D,Actually, these code are from my demo.
http://bbs.mjtd.com/thread-83596-2-1.html
but it's far away from this topic.
I am a bilingualist,Chinese and Chinglish.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Is that possible to Create a "modeless" DCL?
« Reply #8 on: March 02, 2011, 10:21:50 AM »
Might be possible but IMO the investigation wouldn't be worth the time, let alone the implementation.  DCL isn't designed to be modeless.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}