Jump to content

Change popup list contents from one list to another


The Buzzard

Recommended Posts

Hello everyone,

 

I need some help with this.

 

I have a popup list in a dialog. I want to change the contents of the popup list from one list to another list depending on the selection thru a radio button.

 

Another words,

When a different selection of a radio button is made the contents of the popup list change dynamically.

 

I would appreciate any offer of help with this.

 

Thanks in advance,

The Buzzard

Link to comment
Share on other sites

There are a couple of ways to achieve this depending on how you have the dialog box set up. If you could post the file it would help.

You could use the action tile of the radio button to populate the list again depending on how everything is set up.

Link to comment
Share on other sites

Thanks JohnM for your quick responce.

 

As of the moment I have the code somewhat out of commision.

 

But here was how I was trying to do it.

 

 

In the dcl file:

 

                : popup_list {
                 key = "dthk";
                 width = 10.0;
                 fixed_width = true;
                 alignment = centered;
                 value = 0;
               }

 

The radio buttons in the lisp code:

  (action_tile "dT1"                                                ;When radio_button Exterior is selected
"(setq DTYP \"EXT\")")                                             ;Set variable DTYP to Exterior
 (action_tile "dT2"                                                ;When radio_button Interior is selected
"(setq DTYP \"INT\")")                                             ;Set variable DTYP to Interior
 (action_tile "dT3"                                                ;When radio_button Cabinet is selected
"(setq DTYP \"CAB\")")                                             ;Set variable DTYP to Cabinet

 

The action tile for the popup list:

  (IDS_DTS DTYP)
 (action_tile "dthk"                                               ;When radio_button Exterior is selected
"(IDS_DTS DTYP)")                                                  ;Set variable DTYP to Exterior

 

And finally a separate function to cause the change:

 

(defun IDS_DTS (DTYP)                                               ;Define function

 (cond
   ((= DTYP "EXT")
   (setq dthk_list '("2-1/4\"" "2\"")))
   ((= DTYP "INT")
   (setq dthk_list '("1-3/4\"" "1-3/8\"")))
   ((= DTYP "CAB")
   (setq dthk_list '("1\"" "3/4\"")))
 )
 (setq TYP DTYP)
 (setq LIST-No dthk_list)
 (start_list "dthk")                                               ;Start list
 (cond
   ((= TYP "EXT") 
   (mapcar 'add_list LIST-No))
   ((= TYP "INT") 
   (mapcar 'add_list LIST-No))
   ((= TYP "CAB") 
   (mapcar 'add_list LIST-No))
 )
 (end_list)
)                                                                   ;End define function

 

At this stage, the code will not change the list unless a cancel and start the dialog again.

 

Wish I had this somewhat in order for you to see, But I can post the complete code later.

 

 

The Buzzard

Link to comment
Share on other sites

JohnM

 

The attached files are the complete program.

The output section of the code has not been completed as yet.

Parts of the input are also not completed.

The dialog will appear to give you an idea of what I am trying to do.

 

Thanks again

The Buzzard

Link to comment
Share on other sites

you need to make a loop in the lisp that controls the dcl file. i call it the in/out file. there is another post here explaining in detail how to do ithttp://www.cadtutor.net/forum/showthread.php?t=32929

 

let me know if you need help

Link to comment
Share on other sites

John,

 

Checked out the link and it has nothing to do with what I am trying to do.

Please realize I have a loop function in my program and it also works. The version I posted is in pieces, So the program will not completely function as I have stated. Thats why I did not want to post the code in the first place. I already know what the other issues are.

 

My question was:

I have a popup list in a dialog. I want to change the contents of the popup list from one list to another list depending on the selection thru a radio button.

 

Another words,

When a different selection of a radio button is made the contents of the popup list change dynamically.

 

That all I want to do.

Link to comment
Share on other sites

The part of the program that populates the dialog box needs the loop in it so when the user clicks the option button the dialog box is re-initialized and displays the new list.

 

The code below is what I wanted you to see on that other post

You can see how it calls the dialog box then populates it and there is a what_next loop for re populating the dialog box when the user pick a button

In this example when the user clicks the accept button, the dialog is hidden, (look at the code (done dialog 4)then the program drops down to the cond function (=what_next 4) then performs a task then loops back to the topt of the file at the start of the while loop then re-initializes the dialog box and populates the results.

If I understand correctly this is kind of what you want to accomplish.

The user clicks an option button then the dialog is re-initialized with the correct list displayed.

 

 
(defun picket:DialogInput (/ dcl_id dialogloaded dialogshow userclick what_next rtvls dstx
       pipx barx
      )
(setq dialogLoaded T
dialogShow T) 
(if (= -1 (setq dcl_id (load_dialog "pickets.DCL")));_looks for and loads the dcl file
(progn
(princ "\nERROR: Cannot load pickets.DCL");_error trapping
(setq dialogLoaded nil)
) ;_ end of progn
) ;_ end of if
(setq what_next 2);_this is a variable for the loop
(while (>= what_next 2);_this is the loop
(if (and (not (new_dialog "PICKETS" dcl_id));_if everything is found let the program proceed
dialogLoaded
) ;_ end of and
(progn
(princ "\nERROR: Cannot show dialog PICKETS");_error trap if there is a problem
(setq dialogShow nil)
) ;_ end of progn
) ;_ end of if
(if (and dialogLoaded dialogShow)
(progn
;;; below is where you assign values to tiles and other stuff
(if rtvls
(progn
(set_tile "end1" (rtos(nth 0 rtvls)2 3))
(set_tile "sp" (rtos(nth 1 rtvls)2 3))
(set_tile "sp2" (rtos(nth 2 rtvls)2 3))
(set_tile "end2" (rtos(nth 3 rtvls)2 3))
);_progn
(progn
(set_tile "end1" "")
(set_tile "sp" "")
(set_tile "sp2" "")
(set_tile "end2" "")
);_progn
);_if

       (if dstx (set_tile "x" dstx)(set_tile "x" ""))
(if pipx (set_tile "y" pipx)(set_tile "y" ""))
(if barx (set_tile "z" barx)(set_tile "z" ""))


(action_tile "cancel" "(done_dialog)(setq UserClick nil) ");_if user click the cancle button make dlg go bye-bye
;;; if user clicks ok  button assign tile values to variables 
(action_tile "accept" 
(strcat
"(progn"
"(setq dstx (get_tile \"x\"))"
"(setq pipx (get_tile \"y\"))"
"(setq barx (get_tile \"z\"))"
"(if (not (member \"\" (list dstx pipx barx)))"
"(progn"
"(done_dialog 4)"
")" ;_progn
"(alert \"Please enter values\")"
")" ;_if
")" ;_progn
) ;_end strcat
) ;_ end of action_tile
(setq what_next (start_dialog))
) ;_ end of progn
) ;_ end of if
(cond
((= what_next 4)
(setq rtvls (picket (atof dstx)(atof pipx)(atof barx))));_do this if user clicks the button named qdx_wld
);_end cond
);_end while
(unload_dialog dcl_id) 
)

Link to comment
Share on other sites

John,

 

Sorry I did not get back to you sooner. I will try to digest this, Although it will not be easy. I briefly looked over the code and there seems to be alot going on in it.

 

There is probably more in going on in that code then what I actually need. So it looks very confusing. I have a style that I am acustom to, So I will also need to adjust it in a manner that I can understand.

 

I will get back to you and let you know how its going.

 

Again Thank You,

The Buzzard

Link to comment
Share on other sites

Hey John,

 

I looked over the program and tested it. Its not what I was looking for. It is a nice program, But I have programs that do similar tasks, And use slightly different methods. I am just going to take a different route now.

 

Thank you for taking the time to help.

The Buzzard

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