Jump to content

List Box, How Do You Highlight The Value?


The Buzzard

Recommended Posts

Thanks Buzzard,

 

Yeah, the function for set-tile was to aid in the error checking, for cases such that the list has length 3, but the global points to item 4...

 

As you guessed, the globals are those with asterisks :)

 

Oh, and I only used a single VL function (vl-prin1-to-string), just to aid in writing the action_tile statements, (makes things easier to read in the VLIDE).

 

If you have any questions, or find any quirks, let me know.

 

Lee

Link to comment
Share on other sites

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

  • The Buzzard

    26

  • Lee Mac

    17

  • JohnM

    4

  • Bhull1985

    2

Top Posters In This Topic

Posted Images

Again Thank You,

 

Just tested it, And so far so good. I experimented with the dialog over the weekend and it looks great. My first thought with list boxes in the dialog was that it would look shabby, But it turned out for the better. Also it seems to simplify the selection process much better than radio buttons. Here is what I have done with it.

Document1.JPG

Link to comment
Share on other sites

I do find with list_box's that the selection is clearer, as all options are open for the user to see.

 

Glad I could be of help.

Out of curiosity, What was the original error problem? I did notice that the action tiles were written in series and depended upon the first tile although I am not sure if that had anything to do with it. What I do know is the remedy that I cooked up was in no way a solution to the problem. When I checked variables at the command prompt, They all seem to have the correct values. I was a bit puzzled after that.

Link to comment
Share on other sites

It was quite a simple fix actually - the 'Models' variable did not hold a value until the first tile was selected. But I felt it better to rewrite the whole program so that I could include some better trapping. :)

Link to comment
Share on other sites

It was quite a simple fix actually - the 'Models' variable did not hold a value until the first tile was selected. But I felt it better to rewrite the whole program so that I could include some better trapping. :)

So what I did was give it a constant value by setting the tile I suppose. Even if I could not get the old method to save previous values, That sure would not have helped much.

Link to comment
Share on other sites

  • 2 months later...
Buzzard,

 

Have fun playing around with this one :)

 

Lee, I had to :lol: when I ran your example and was told I couldn't afford my selection. You mean I'm not the only CAD monkey who doesn't make that much money?

 

BTW, I came across this thread as I am researching DCL / Lisp relationships as they apply to multiple list boxes. Your code has given me good insight so thanks. Below is my failed attempt at trying to do it on my own (with minimal help and a book I got and a Lisp command guide Alan shared with me). I was thinking the only way I'm really going to learn to write code in Lisp is to sit down and do it and not just copy other people's code, but it's very difficult to say the least. So I'm back trying to look at other code examples and trying to learn what it means and then trying to adapt it to my own needs.

 

(defun c:notes (/ dcl_id folderlist fname fIndex fSel notelist nname nIndex nSel)
 (setq dcl_id (load_dialog "notes.dcl"))
 (if (not (new_dialog "notes" dcl_id))
   (progn
     (alert "The notes.dcl file could not be loaded!")
     (exit)
   )
 )
 (setq    folderlist
    (list "Electrical"   "General"         "Outfitting"
          "Piping"          "Removal"         "Structure"
          "Test"
         )
 )
 (start_list "folderlist" 3)
 (mapcar 'add_list folderList)
 (end_list)

 (action_tile "cancel" "(cancelNotes)(done_dialog)")
 (action_tile "accept" "(insertNotes)")
 (action_tile "createbut" "(createNewNote)")
 (action_tile "addbut" "(addNoteToList)")
 (action_tile "subbut" "(subNoteFromList)")

 (start_dialog)
 (unload_dialog dcl_id)

 (setq fname (get_tile "folderlist"))
 (if (/= fname "")
   (progn
     (cond (= fname "Electrical")
       (
        (setq noteslist (list "E01" "E02" "E03")
          )
        (start_list "noteslist" 3)
        (mapcar 'add_list notesList)
        (end_list)
        (setq nname (get_tile "noteslist"))
        (if (/= nname "")
          (progn
        (setq nIndex (atoi nname))
        (setq nSel (nth nIndex noteslist))
        )
          (progn
        (setq nIndex -1)
        (setq nSel nil)
        )
          )
        )
       (= fname "General")
       (
        (setq noteslist (list "G01" "G02" "G03" "G04")
          )
        (start_list "noteslist" 3)
           (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Outfitting")
       ((setq    noteslist
    (list "O01")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)

 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Piping")
       ((setq    noteslist
    (list "P01" "P02" "P03" "P04" "P05" "P06" "P07")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Removal")
       ((setq    noteslist
    (list "R01")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Structure")
       ((setq    noteslist
    (list "S01" "S02" "S03")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Test")
       ((setq    noteslist
    (list "T01")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
     )
     (setq fIndex (atoi fname))
     (setq fSel (nth fIndex folderlist))
   )
   (progn
     (setq fIndex -1)
     (setq fSel nil)
   )
 )
)

(defun cancelNotes ()
 (princ "\n\n ...Notes Manager cancelled. \n")
)

(defun insertNotes ()
 (alert "Coming soon!")
)

(defun createNewNote ()
 (alert "Coming soon!")
)

(defun addNoteToList ()
 (alert "Coming soon!")
)

(defun subNoteFromList ()
 (alert "Coming soon!")
)

BTW, I only wrote enough code to try and get the two list boxes to populate so that's why the rest is unfinished.

 

Lonnie

notes.dcl

Link to comment
Share on other sites

I'm trying to create a view that would display a block

Would I create a slide? If so, are there any good sites I can go to that will show me how to make one

I'm pretty new to dcl

 

section : dialog {
         label = "Section tag V1.0";
         
      : row {
      
      : boxed_column {
        label = "View";
      : image {
        key = "Img";
        height = 10.0;
        fixed_height = true;
        width = 20.0;
        fixed_width = true;
        alignment = centered;
        color = -2; }}
        
       : boxed_radio_column {
         label = "Direction" ;
       : radio_button {
       key = "1" ;
       label = "Left" ;
       value = "1";}
     : radio_button {
       key = "2" ; 
       label = "Right" ;}
     : radio_button {
       key = "3" ; 
       label = "Up" ;}
     : radio_button {
       key = "4" ;
       label = "Down" ;}}
       
       }
       
       : boxed_column {
         label = "Label" ;
       : edit_box {
         label = "Tag Label: ";
         key = "tag";
         mnemonic = "t";
         edit_limit = 5;
         edit_width = 5;
         value = "A";
         alignment = centered;}
       : paragraph {}}
       
       :row {
       
: button {
key = "accept";
label = "Insertion Point";
is_default = true;
fixed_width = true;}
 : button {
key = "cancel";
label = "Cancel";
is_default = false;
fixed_width = true;}

}
}

Link to comment
Share on other sites

Lee, I had to :lol: when I ran your example and was told I couldn't afford my selection. You mean I'm not the only CAD monkey who doesn't make that much money?

 

BTW, I came across this thread as I am researching DCL / Lisp relationships as they apply to multiple list boxes. Your code has given me good insight so thanks. Below is my failed attempt at trying to do it on my own (with minimal help and a book I got and a Lisp command guide Alan shared with me). I was thinking the only way I'm really going to learn to write code in Lisp is to sit down and do it and not just copy other people's code, but it's very difficult to say the least. So I'm back trying to look at other code examples and trying to learn what it means and then trying to adapt it to my own needs.

 

(defun c:notes (/ dcl_id folderlist fname fIndex fSel notelist nname nIndex nSel)
 (setq dcl_id (load_dialog "notes.dcl"))
 (if (not (new_dialog "notes" dcl_id))
   (progn
     (alert "The notes.dcl file could not be loaded!")
     (exit)
   )
 )
 (setq    folderlist
    (list "Electrical"   "General"         "Outfitting"
          "Piping"          "Removal"         "Structure"
          "Test"
         )
 )
 (start_list "folderlist" 3)
 (mapcar 'add_list folderList)
 (end_list)

 (action_tile "cancel" "(cancelNotes)(done_dialog)")
 (action_tile "accept" "(insertNotes)")
 (action_tile "createbut" "(createNewNote)")
 (action_tile "addbut" "(addNoteToList)")
 (action_tile "subbut" "(subNoteFromList)")

 (start_dialog)
 (unload_dialog dcl_id)

 (setq fname (get_tile "folderlist"))
 (if (/= fname "")
   (progn
     (cond (= fname "Electrical")
       (
        (setq noteslist (list "E01" "E02" "E03")
          )
        (start_list "noteslist" 3)
        (mapcar 'add_list notesList)
        (end_list)
        (setq nname (get_tile "noteslist"))
        (if (/= nname "")
          (progn
        (setq nIndex (atoi nname))
        (setq nSel (nth nIndex noteslist))
        )
          (progn
        (setq nIndex -1)
        (setq nSel nil)
        )
          )
        )
       (= fname "General")
       (
        (setq noteslist (list "G01" "G02" "G03" "G04")
          )
        (start_list "noteslist" 3)
           (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Outfitting")
       ((setq    noteslist
    (list "O01")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)

 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Piping")
       ((setq    noteslist
    (list "P01" "P02" "P03" "P04" "P05" "P06" "P07")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Removal")
       ((setq    noteslist
    (list "R01")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Structure")
       ((setq    noteslist
    (list "S01" "S02" "S03")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
       (= fname "Test")
       ((setq    noteslist
    (list "T01")
 )
 (start_list "noteslist" 3)
 (mapcar 'add_list notesList)
 (end_list)
 (setq nname (get_tile "noteslist"))
 (if (/= nname "")
   (progn
     (setq nIndex (atoi nname))
     (setq nSel (nth nIndex noteslist))
   )
   (progn
     (setq nIndex -1)
     (setq nSel nil)
   )
 ))
     )
     (setq fIndex (atoi fname))
     (setq fSel (nth fIndex folderlist))
   )
   (progn
     (setq fIndex -1)
     (setq fSel nil)
   )
 )
)

(defun cancelNotes ()
 (princ "\n\n ...Notes Manager cancelled. \n")
)

(defun insertNotes ()
 (alert "Coming soon!")
)

(defun createNewNote ()
 (alert "Coming soon!")
)

(defun addNoteToList ()
 (alert "Coming soon!")
)

(defun subNoteFromList ()
 (alert "Coming soon!")
)

BTW, I only wrote enough code to try and get the two list boxes to populate so that's why the rest is unfinished.

 

Lonnie

 

I'm trying to create a view that would display a block

Would I create a slide? If so' date=' are there any good sites I can go to that will show me how to make one

I'm pretty new to dcl

 

section : dialog {
         label = "Section tag V1.0";

      : row {

      : boxed_column {
        label = "View";
      : image {
        key = "Img";
        height = 10.0;
        fixed_height = true;
        width = 20.0;
        fixed_width = true;
        alignment = centered;
        color = -2; }}

       : boxed_radio_column {
         label = "Direction" ;
       : radio_button {
       key = "1" ;
       label = "Left" ;
       value = "1";}
     : radio_button {
       key = "2" ; 
       label = "Right" ;}
     : radio_button {
       key = "3" ; 
       label = "Up" ;}
     : radio_button {
       key = "4" ;
       label = "Down" ;}}

       }

       : boxed_column {
         label = "Label" ;
       : edit_box {
         label = "Tag Label: ";
         key = "tag";
         mnemonic = "t";
         edit_limit = 5;
         edit_width = 5;
         value = "A";
         alignment = centered;}
       : paragraph {}}

       :row {

: button {
key = "accept";
label = "Insertion Point";
is_default = true;
fixed_width = true;}
 : button {
key = "cancel";
label = "Cancel";
is_default = false;
fixed_width = true;}

}
}

[/quote']

 

This is an old thread.

You guys will get alot more better replys if you start a new thread on your subject.

Edited by The Buzzard
Link to comment
Share on other sites

  • 3 years later...

Does anyone know how to do this who would be willing to answer some questions so that I may get past this portion ?

Now I understand completely how office workers often would "go postal"

This is so terribly frustrating.

I don't know how to construct a list of data that will allow the $value callback to select the appropriate slide file for a preview box tacked on to what Lee created in this thread's earlier posts

Link to comment
Share on other sites

Okay, I have received sufficient assistance in order to complete my task.

Apologies for being impatient as I know I am.

THANK YOU CAB!!!!

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