Author Topic: Dcl troubles (ofcourse its dcl)  (Read 4778 times)

0 Members and 1 Guest are viewing this topic.

whdjr

  • Guest
Dcl troubles (ofcourse its dcl)
« on: November 22, 2004, 11:54:48 AM »
Alright I need a dcl master (if there is such a thing).
I have a dcl file that has a listbox, editbox, update button, apply button, and a cancel button.  I have made the update and apply buttons unavailable until something is selected in the listbox and the editbox; however I can't get the editbox to return a value to the program until I click back in the listbox.  Is there anyway to read the editbox without getting out of the box.  The process I am desiring to get is for the user to select any number of line items in the listbox and then input a number in the editbox, then the update button will be available for use.  Does this make any sense at all?


Here is my dialog box

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Dcl troubles (ofcourse its dcl)
« Reply #1 on: November 22, 2004, 12:19:02 PM »
not really. The value of dcl tiles are generally not checked until there is a change of state, such as clicked or lost focus. VBA forms would allow you to do a much better job if I am understanding what you are trying to do.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

whdjr

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #2 on: November 22, 2004, 12:23:14 PM »
Unfortunately I don't know any VBA.

whdjr

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #3 on: November 22, 2004, 12:35:47 PM »
Quote from: Keith
The value of dcl tiles are generally not checked until there is a change of state, such as clicked or lost focus.

How do you make an edit box lose focus or show that it has been clicked?

SMadsen

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #4 on: November 22, 2004, 02:43:59 PM »
You can't register an entry into an edit_box. It'll only issue a callback upon exit.

If your criteria for enabling the buttons are that
1. items have been selected in the list and,
2. the edit_box holds a value,
then I would maintain a list of selected items and call GET_TILE to see if the edit_box holds an input. Only when both the list and an input is present, the buttons should be enabled.

whdjr

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #5 on: November 22, 2004, 03:41:24 PM »
Thanks for the suggestion stig, but how does the prog know when I put something in the edit box.  Basically when do I call get_tile on the editbox?

SMadsen

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #6 on: November 23, 2004, 04:51:01 AM »
Here's a small example to show what I mean. When selecting items in the list_box, it builds a list of selected items. It also checks if the edit_box holds a value. If so, enable the buttons. If not, disable the buttons. This is where the GET_TILE comes in.
When leaving the edit_box, it checks to see if any list of selected items has been built. If so, and if a value has been entered, enable the buttons. If not, disable them.

It would be easier to do this on getting focus but ignoring events in general is, as hinted before, one of the many shortcomings of DCL. So this could be sort of a way to compensate. The user won't see it much different.

Code: [Select]
;;LSP code

;;; Function from the online help "Working with Programmable
;;; Dialog Boxes" -> "Processing List Elements" to convert
;;; a multiple list_box selection to a list (edited to rid of
;;; the global list)
(defun MK_LIST (readlist displist / count item retlist)
  (setq count 1)
  (while (setq item (read readlist))
    (setq retlist (cons (nth item displist) retlist))
    (while (and (/= " " (substr readlist count 1))
                (/= "" (substr readlist count 1))
           )
      (setq count (1+ count))
    )
    (setq readlist (substr readlist count))
  )
  (reverse retlist)
)


(defun whdjr (/ dcl_id samples enableBtns doListBox doEditBox listpicks)

  ;; To toggle is_enabled for two named buttons
  (defun enableBtns (flag)
    (mode_tile "btn_update" flag)
    (mode_tile "btn_apply" flag)
  )

  ;; Callback for "list_1" list_box. Checks if buttons
  ;; should be en-/disabled and returns selected
  ;; items in a list
  (defun doListBox (value lst)
    (if (and (/= (get_tile "edit_1") "")
             (setq lst (MK_LIST value lst))
        )
      (enableBtns 0)
      (enableBtns 1)
    )
    lst
  )

  ;; Callback for edit_box "edit_1". Checks to see if
  ;; buttons should be en-/disabled.
  ;; Should also contain validation and storage of contents.
  (defun doEditBox (value lst)
    ;; validation could go here ...
    (if (and lst (/= value ""))(enableBtns 0)(enableBtns 1))
    ;; return value could go here ...
  )

  (setq samples '("Item_1" "Item_2" "Item_3" "Item_4"))
  (setq dcl_id (load_dialog "test.dcl"))
  (cond ((new_dialog "whdjr" dcl_id)
         ;; fill list into "list_1"
         (start_list "list_1")
         (mapcar 'add_list samples)
         (end_list)
         ;; initial disabling of buttons
         (mode_tile "btn_update" 1)
         (mode_tile "btn_apply" 1)

         (action_tile "list_1"
           "(setq listpicks (doListBox $value samples))"
         )

         (action_tile "edit_1" "(doEditBox $value listpicks)")
         (start_dialog)
        )
  )
)

//DCL code

whdjr : dialog {
  : list_box {
    key = "list_1";
    width = 16;
    multiple_select = true;
  }
  : edit_box {
    key = "edit_1";
    edit_width = 16;
  }
  : button {
    key = "btn_update";
    label = "Update";
  }
  : button {
    key = "btn_apply";
    label = "Apply";
  }
  cancel_button;
}

SPDCad

  • Bull Frog
  • Posts: 453
Dcl troubles (ofcourse its dcl)
« Reply #7 on: November 23, 2004, 09:39:49 AM »
Quote from: Keith
VBA forms would allow you to do a much better job


You can get all the functionality of the VBA form but still be able to programme in LISP with ObjectDCL. Its easy to learn and very powerful.

You can find ObjectDCL at www.objectdcl.com

The programme is not free, but the demo package does not have a time limit or functionally limit. Only a little nag message at the begining of ech programme, which you can click to continue to your programme.

I use ObjectDCL with all my Lisp now.  


 :D
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs

whdjr

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #8 on: November 23, 2004, 10:01:37 AM »
Quote from: SPDCad
You can get all the functionality of the VBA form but still be able to programme in LISP with ObjectDCL.

Yeah but doesn't the end user also have to have ObjectDCL as well?

Columbia

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #9 on: November 23, 2004, 12:41:48 PM »
Yep.  Well sort of.  The end user needs the Object DCL enabler.  Which is a free file that the makers of Object DCL make available to you, the developer.  All you need to do then is make sure that the user has that .arx enabler file and you are good to go.

Anonymous

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #10 on: November 23, 2004, 04:16:07 PM »
Quote from: whdjr
Yeah but doesn't the end user also have to have ObjectDCL as well?


Columbia has summed it up pretty well.

Unless you write your  lisp in such a way, that the DCL file is written by the code as you run your lisp, you have to include additional files  (dcl file) when sending out your lisp. So you distribute the ObjectDCL ARX as well as the ODC file as part of your Lisp package. No big deal.  :)

Sharplisp (Lisp to C converter) made by the same company in their next release is to allow for a single file that contains the ODS and LISP files. Therefore all that you will have to distribute if the ObjectDCL.arx and your programme.arx file.
When will they release this product, only they know. 3rd day Software is starting to resemble Microsoft with their promises.
 :cry:

SPDCad

  • Bull Frog
  • Posts: 453
Dcl troubles (ofcourse its dcl)
« Reply #11 on: November 24, 2004, 12:37:11 AM »
I guess I needed to log on when I posted the above comment.

Oops I remember now, I started the response and was not able to get back to it until a hour later, so I guess I timmed out. :(
AutoCAD 2010, w/ OpenDCL

visit: http://reachme.at/spd_designs

Columbia

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #12 on: November 24, 2004, 08:04:51 AM »
Quote
Unless you write your lisp in such a way, that the DCL file is written by the code as you run your lisp, you have to include additional files (dcl file) when sending out your lisp


Well that's not exactly true, if you're using VisualLISP.  You can compile your DCL file and the LSP file into one VLX file.

This is very, very handy and significantly reduces the risk of accidentally killing an app by deleting the DCL.

But that's not really the issue here is it... :?

whdjr

  • Guest
Dcl troubles (ofcourse its dcl)
« Reply #13 on: November 24, 2004, 09:05:28 AM »
Thanks guys for the comments.

Quote from: SMadsen
Here's a small example to show what I mean.

I had mine essentially setup the same way you showed Stig, but it wasn't the way I wanted it to work.  I guess I need to accept the fact that this is a limitation of dcl and figure out another way around the issue.

Quote from: SPDCad
You can get all the functionality of the VBA form but still be able to programme in LISP with ObjectDCL.

I don't want to rely on a third party program to operate my tools.  I will inadvertantly need it one day and I won't have it available.

Thanks guys,