help with boxed_radio_column with multiple rows?

help with boxed_radio_column with multiple rows?

DC-MWA
Collaborator Collaborator
6,363 Views
29 Replies
Message 1 of 30

help with boxed_radio_column with multiple rows?

DC-MWA
Collaborator
Collaborator

Hi all,

I'm trying to make a help file for one of the larger programs we use.

I've got the basics figured out.

I'm using radio buttons to call up text describing each function.

At this point I can only make one row of radio buttons. If I break them up into two, I lose the functionality of the buttons.

I'm looking to have a radio_column with two or more rows within.

I have attached the lisp and dcl files.

I'm hoping this is semi-simple although after searching, I'm not sure.

Thanks.

-dc

 

 

 

0 Likes
Accepted solutions (1)
6,364 Views
29 Replies
Replies (29)
Message 2 of 30

Sea-Haven
Mentor
Mentor

Not sure if this will help but this is my radio button pick method it returns button number. RB1-RBx etc. So second radio button column would be say RB6+

 

(setq x 1)
(repeat (- (length butlst) 1)
(setq k (strcat "Rb" (rtos x 2 0)))
(action_tile k  (strcat "(setq but "  (rtos x 2 0) ")" "(done_dialog)"))
(if (= ahdef x)(set_tile k "1")) ; sets button default to 1st button
(setq x (+ x 1))
)

 

 

0 Likes
Message 3 of 30

DC-MWA
Collaborator
Collaborator

Not sure how to apply this to my situation. I will play with it and see where it takes me.

Thank you very much for your reply.

-dc

0 Likes
Message 4 of 30

Sea-Haven
Mentor
Mentor

The repeat would be total number of buttons the key is RBX and it returns the button number not a value. so you would have a cond checking button number. I have not tested just an idea.

0 Likes
Message 5 of 30

DC-MWA
Collaborator
Collaborator

I could not wrap my simple mind around your code.

So I went dawn another path. I got the multiple rows to work in the radio_column, but now I do not know how to get "Mylist" to display in the list_box. The radio buttons work but...

Capture.JPG

I'm hoping I'm close and this an easy fix.

See attached lsp and dcl files.

0 Likes
Message 6 of 30

Sea-Haven
Mentor
Mentor

Have a look at Lee-mac.com "Listbox" example.

 

So you want to click a radio button then have a help message, why not just use (alert msg1) etc just have the options buttons only.

 

You can have a edit box called Text but you will have to close and reopen the dcl. So you might start with Option 1 and then as you pick redo the text.

 

 

0 Likes
Message 7 of 30

DC-MWA
Collaborator
Collaborator

Thank you.

The lisp I sent first "test.lsp" it uses radio buttons to display text based on selection but has only one row in radio_column.

The second lisp "doit.lsp" has multiple rows in radio_column, does not display text in list_box.

In test.lsp it works wihout closing and reopening the dcl.

 

I'll keep trying. Thank you for your time my friend.

0 Likes
Message 8 of 30

john.uhden
Mentor
Mentor

You could switch your approach to an array of toggles, such that when you pick one it toggles the others off.

I don't think Autodesk provides a radio_array option.

John F. Uhden

0 Likes
Message 9 of 30

DC-MWA
Collaborator
Collaborator

I got the multiple rows to work.

Now I'm having trouble it to show mylist at selection at it did my first attempt.

0 Likes
Message 10 of 30

DC-MWA
Collaborator
Collaborator

Capture.JPG

0 Likes
Message 11 of 30

Anonymous
Not applicable

@DC-MWA  Does this solve your problem ??
If yes I will make adaptations and I will set the example for you !!

 

0 Likes
Message 12 of 30

DC-MWA
Collaborator
Collaborator

That's what I need except I need multiple rows of radio buttons otherwise the dialog gets huge.

0 Likes
Message 13 of 30

Anonymous
Not applicable

@DC-MWA  Sorry for not having time to make the changes !!
One question: Why not use popup_list instead of this huge list of radio_buttons ??

0 Likes
Message 14 of 30

DC-MWA
Collaborator
Collaborator

Pop-up list would work. The program I'm working on needs to put the separate items in the face of my users.

When it opens pow! options in your face.  lol

0 Likes
Message 15 of 30

Sea-Haven
Mentor
Mentor

Copy this to command Line

 

(alert (strcat "this is a pop up\n\nIts in your face \n\nand very simple to create"))
0 Likes
Message 16 of 30

DC-MWA
Collaborator
Collaborator

Alert box? How does this help?

0 Likes
Message 17 of 30

Anonymous
Not applicable

I came back lol.

I attached the example of how you can deal with these sutuations, make the modifications on your own.

Observations:

  • As I said, I replaced radio_button with popup_list.
  • I'm just a novice in this AutoLISP world and I probably have a smarter way of writing this.

I hope it helps.
If it solved your problem, mark it as a solution.

 

;c:BRCWM
;;by - Júnior Nogueira
;;------------------------------------------------------------;;
(defun c:BRCWM ( / dcltest listX list1 list2 list3 dx dy )

;;add *error* handling on your own
 (JR:writedcl)
 (setq dcltest (load_dialog dcl))
 (if (> dcltest 0)
  (if (new_dialog "dclt" dcltest)
   (progn
    (setq erro* "Function cancelled,quit / exit abort,console break/ list nil")
    (setq list1 '("ItemX" "ItemX" "ItemX" "ItemX" "ItemX"))
    (setq list2 '("ItemY" "ItemY" "ItemY" "ItemY" "ItemY"))
    (setq list3 '("ItemZ" "ItemZ" "ItemZ" "ItemZ" "ItemZ"))
    ;(setq dx (dimx_tile "img"))
    ;(setq dy (dimy_tile "img"))

    ;;go first here!
    (defun JR:radiobuttons ( radiobuttons )
     (cond
      ((= radiobuttons "radiobuttons1")   (setq listX  list1  topico  "radiobuttons1"))
      ((= radiobuttons "radiobuttons2")   (setq listX  list2  topico  "radiobuttons2"))
      ((= radiobuttons "radiobuttons3")   (setq listX  list3  topico  "radiobuttons3"))
     )
     (start_list "item" 3)
     (mapcar 'add_list listX)
     (end_list)
     ;(start_image "img") ; previous code!
     ;(fill_image 0 0 dx dy 0)(end_image) ; previous code!
     (set_tile "msg" "Select an item from the list, please")
    );defin end!!

    (foreach x '("radiobuttons1" "radiobuttons2" "radiobuttons3")
     (action_tile x "(JR:radiobuttons $key)")
    )
    (action_tile "item" "(setq item (nth (atoi $value) listX))") ; previous code!
    (action_tile "help" "(c:JR:Help)")
    (action_tile "cancel" "(done_dialog 0)" )
    (action_tile "accept" "(if item (done_dialog 1)(alert erro*))")
    (setq reason (start_dialog))
    (unload_dialog dcltest)
    (cond 
     ((= reason 0) (princ "\nCanceled."))
     ((= reason 1)(JR:Actiontopicitem topico item))
    )
   );;progn end!!
  );;If end!!
  (alert "Oops, the dcl file could not be loaded!")
    )
 (if (and dcl (setq dcl (findfile dcl)))
  (vl-file-delete dcl)
 )
  (princ)
)
;;------------------------------------------------------------;
;JR:actiontopicitem
;;Dcl Actions
;;Arguments [topic] and [Item]

(defun JR:Actiontopicitem ( %topico %item / postesbloco )
 (alert (strcat "Do something in " %topico " and " %item))
)

;;------------------------------------------------------------;
;;JR:writedcl - Junior Nogueira
;;write your help
;;No arguments
(defun c:JR:Help nil
 (alert "Your help!")
)
;;------------------------------------------------------------;
;;JR:writedcl - Junior Nogueira
;;Write the dcl in my temp folder!
;;No arguments
(defun JR:writedcl ( )
 (if
  (and (setq dcl (vl-filename-mktemp "tmp.dcl"))(setq arquivo (open dcl "w")))
   (mapcar '(lambda (x) (write-line x arquivo))
    (list
     "dclt : dialog"
     "{"
     "label=\"Teste - Autor: Júnior Nogueira , V 1.0\";"
     "initial_focus=\"msg\";"
     ": spacer"
     "  {"
     "  height=1;"
     "  }"
     "  : text"
     "  {"
     "   label=\"Select the topic and then the item\";"
     "   key=\"msg\";"
     "     alignment=centered;"
     "     height=2;"
     "  }"
     "  : row"
     "   {"
     "   alignment=centered;"
     "   fixed_width=true;"
     "   spacer;"
     "     : column"
     "     {"
     "       alignment=top;"
     "       fixed_width=true;"
     "       fixed_height=true;"
     "       : text"
     "       {"
     "       label=\"Select topic\";"
     "       }"
     "     : radio_column"
     "     {"
     "        alignment=top;"
     "        fixed_height=true;"
     "       : radio_button"
     "       {"
     "        label=\"radiobuttons1\";key=\"radiobuttons1\";"
     "       }"
     "       : radio_button"
     "       {"
     "        label=\"radiobuttons2\";key=\"radiobuttons2\";"
     "       }"
     "       : radio_button"
     "       {"
     "        label=\"radiobuttons3\";key=\"radiobuttons3\";"
     "       }"
     "     }"
     "  }"
     "    spacer;"
     "  : column"
     "   {"
     "     alignment=top;"
     "     children_fixed_width=true;"
     "     children_fixed_height=true;"
     "        : text"
     "        {"
     "          label=\"Select item\";"
     "        }"
     "        : list_box"
     "        {"
     "           key=\"item\";"
     "           width=40;"
     "           height=16;"
     "           alignment=top;"
     "        }"
     "    }"
     "    spacer;"
     "    spacer;"
     "   }"
     "    spacer;"
     "  : column"
     "  {"
     "   :concatenation"
     "     {"
     "       alignment=centered;"
     "       children_fixed_width=true;"
     "       : button"
     "         {"
     "         label=\"help\";key=\"help\";"
     "         width=15;"
     "         height=2;"
     "         }"
     "       : button"
     "         {"
     "         label=\"cancel\";key=\"cancel\";"
     "         is_cancel=true;"
     "         width=15;"
     "         height=2;"
     "         }"
     "       : button"
     "         {"
     "         label=\"accept\";key=\"accept\";"
     "         width=15;"
     "         height=2;"
     "         }"
     "      }"
     "   }"
     "}"
     ""
    )
   )
  )
 (if arquivo
  (close arquivo)
 )
)

 

 

0 Likes
Message 18 of 30

DC-MWA
Collaborator
Collaborator

First: let me say that this awesome, no separate dcl file... love it!

Second: I truly appreciate your time and effort on this.

 

As the name of the post states, I'm trying to get multiple rows of radio buttons. In the DOIT.lsp I attached, I got the multiple rows of radio buttons to work properly, I just can't get the description to show in the list_box.

 

In your code, the description works well, but I need multiple rows of radio buttons.Capture.JPG

Again, I truly appreciate your time and effort on this.

Thank you

-dc

 

0 Likes
Message 19 of 30

Sea-Haven
Mentor
Mentor

My Autocad R12 customization manual refers to dcl "text_part" as a tile, it can be one line or multiple lines. This may be one way around the problem, my manual is a paper copy but there should be a online copy at Autodesk under "developers help, regarding DCL's"

 

You could look at calling a sub dcl it will display over top till say you press OK 

 

I found some sample code. Just use find its about 1/2 way down.

 

 

 

 

0 Likes
Message 20 of 30

DC-MWA
Collaborator
Collaborator

Thank you.

0 Likes