Jump to content

List Box, How Do You Highlight The Value?


The Buzzard

Recommended Posts

Buzzard,

 

Have fun playing around with this one :)

Thanks Lee,

 

But this code has popup lists. I had popup lists in my code and did not have a problem originally. I am using list boxes as you know and for some reason they are reacting differently to the coding. I will go down another avenue if I have to. Thanks Again.

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

What are you talking about?

 

The DCL code I posted consists of three list boxes :huh: But what's more, it could just as easily have popup_lists - they work in exactly the same way. Did you not look at the code?

 

I'm happy to help Buzzard, but if you are going to dismiss my help, then I am wasting my time.

Link to comment
Share on other sites

Lee,

 

I think there is a mix up with another dcl of the same name that was done by you. I will place the old someplace else and try again. It was showing as a popup list.

 

Sorry about that.

TEST.JPG

Link to comment
Share on other sites

Buzzard,

I looked over the code that you posted and at first glance you need to localize your variables. This could cause you issues.

You might want to consider breaking up the program to make it easer to troubleshoot

Please don’t take this the wrong way I know every programmer has their own style.

When I use DCL I have one file for my DCL then I have one file form my lisp that controls the DCL this in my in/out file then I have the main program. So if I have an issue with the dialog box controls I only have to work on the in/out file. But to each there own I guess.

If I understand correctly when the user selects a radio button then it will highlight an item in the class list and size list.

If the user selects an item from the class list then it will highlight an item in the size list and change the radio button

If the user selects an item in the size list it will highlight an item in the class list and change the radio button.

Is this correct?

If so all of this is accomplished in each one of the controls action_tile function. The action tile function is only called when the user selects a tile. So if you want several things to happen when a user selects a tile you have to write the code in each action tile.

Example:

(action_tile radio_button

set_tile “class” “x”

set_tile “size” “x”

);_if user selects a radio button set class and size

(action_tile class

set_tile “radio button” “x”

set_tile “size” “x”

);_if user selects class set size and radio

(action_tile size

set_tile “radio button” “x”

set_tile “class” “x”

);_if user selects size set class and radio

hope this helps

Link to comment
Share on other sites

Buzzard,

I looked over the code that you posted and at first glance you need to localize your variables. This could cause you issues.

You might want to consider breaking up the program to make it easer to troubleshoot

Please don’t take this the wrong way I know every programmer has their own style.

When I use DCL I have one file for my DCL then I have one file form my lisp that controls the DCL this in my in/out file then I have the main program. So if I have an issue with the dialog box controls I only have to work on the in/out file. But to each there own I guess.

 

If I understand correctly when the user selects a radio button then it will highlight an item in the class list and size list.

If the user selects an item from the class list then it will highlight an item in the size list and change the radio button

If the user selects an item in the size list it will highlight an item in the class list and change the radio button.

Is this correct?

 

If so all of this is accomplished in each one of the controls action_tile function. The action tile function is only called when the user selects a tile. So if you want several things to happen when a user selects a tile you have to write the code in each action tile.

 

Example:

(action_tile radio_button

set_tile “class” “x”

set_tile “size” “x”

);_if user selects a radio button set class and size

 

(action_tile class

set_tile “radio button” “x”

set_tile “size” “x”

);_if user selects class set size and radio

 

(action_tile size

set_tile “radio button” “x”

set_tile “class” “x”

);_if user selects size set class and radio

 

hope this helps

John,

 

This code is work in progress, Thats why I did not localize variables. If you noticed there is no layer or output functions. I need to test the variables. Please take notice that my code is broken up to make it easier to understand (Notice the separators). What I posted did work with popup lists. The problem is with list boxes. Why? I do not know. For now I am putting this one on ice.

 

Thanks for the help.

Link to comment
Share on other sites

Buzzard,

 

Did you review my example?

Hey Lee,

 

Yes I reviewed it and edited as well. It works great, But I do not like the way the dialog is set up. I prefer the traditional way of making dialogs with more flexibility. I also want to control the flange types by way of radio buttons as it adds some character to the dialog. I am just not familiar with this way of coding. I could not help but notice that for the example you showed this method is OK, However for my example I had to make lists with redundant information which sort of looks on the tacky side.

 

I am still trying to absorb some of this. There is a lot to take in.

I will get back to you when get some of this down.

 

Thanks

Link to comment
Share on other sites

It works great, But I do not like the way the dialog is set up. I prefer the traditional way of making dialogs with more flexibility.

 

Do you mean the way that the DCL file is set up?

 

I also want to control the flange types by way of radio buttons as it adds some character to the dialog.

 

Of course - I just used three list_boxes to give you the idea.

 

 

I am just not familiar with this way of coding. I could not help but notice that for the example you showed this method is OK, However for my example I had to make lists with redundant information which sort of looks on the tacky side.

 

I'm not sure what you mean by the redundant information - the list format is just what suited my information. You can have the data in any format you like.

 

But notice the way that I manipulate the list_boxes.

Link to comment
Share on other sites

Do you mean the way that the DCL file is set up?

 

 

 

Of course - I just used three list_boxes to give you the idea.

 

 

 

 

I'm not sure what you mean by the redundant information - the list format is just what suited my information. You can have the data in any format you like.

 

But notice the way that I manipulate the list_boxes.

I am going to try to see if I can mix other actions tiles in the program with this method. It is not that easy I'm afraid. You get used to doing things a certain way. It going to take some time.

Link to comment
Share on other sites

By the way, Here is the list I was telling you about.

  (setq Data
    '(
      ("Blind"        . (("150"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("300"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("400"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("600"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("900"      . ("3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("1500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("2500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12")))) 
      ("Lap Joint"    . (("150"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("300"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("400"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("600"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("900"      . ("3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("1500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("2500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12")))) 
      ("Slip-On"      . (("150"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("300"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("400"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("600"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("1500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")))) 
      ("Socket Weld"  . (("150"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("300"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("400"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("600"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("900"      . ("3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("1500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")))) 
      ("Threaded"     . (("150"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("300"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("400"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("600"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("900"      . ("3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("1500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("2500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12")))) 
      ("Weld Neck"    . (("150"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("300"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("400"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24"))
                         ("600"      . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "3-1/2" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("900"      . ("3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("1500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12" "14" "16" "18" "20" "24")) 
                         ("2500"     . ("1/2" "3/4" "1" "1-1/4" "1-1/2" "2" "2-1/2" "3" "4" "5" "6" "8" "10" "12")))) 
     )
 ) 

Link to comment
Share on other sites

Well thats probably not the best way to format the list then - as I said, I used that format as it suited the data that I used.

 

Buzzard, when I provide the examples, I'm not saying 'do it exactly like this', but I'm rather offering ideas.

 

I still do not understand this comment:

 

It works great, But I do not like the way the dialog is set up. I prefer the traditional way of making dialogs with more flexibility.
Link to comment
Share on other sites

Well thats probably not the best way to format the list then - as I said, I used that format as it suited the data that I used.

 

Buzzard, when I provide the examples, I'm not saying 'do it exactly like this', but I'm rather offering ideas.

 

I still do not understand this comment:

Lee,

 

At first glance and I was not certain if the dialog was being formated thru the program or not, But now I see it just gathering list information. I suppose I could modify this dialog like any other dialog. Your coding skills are a bit intimidating, So I need to digest a lot of information to make sense of it.

 

I modified the variables with content and noted this in the header.

If I could get thru this much, I could probably finish it the rest of the way.

I hope?

 

Thanks for this,

The Buzzard

AF2.lsp

AF2.dcl

Document1.JPG

Link to comment
Share on other sites

I just try to make things as concise as possible - hence the use of the sub-assembly definition in the DCL file - why type more :P

 

As I said, I only provided this as an example, you needn't use it over your original program. But I'm happy if you can take something from it.

Link to comment
Share on other sites

I just try to make things as concise as possible - hence the use of the sub-assembly definition in the DCL file - why type more :P

 

As I said, I only provided this as an example, you needn't use it over your original program. But I'm happy if you can take something from it.

Well, It works well and returns the required information without a hassle. I would think thats the most important factor. The looks I will have to work on.

Link to comment
Share on other sites

Lee,

 

Found one quirk with this code. When you first start the code and select from the Class list you get the following error message upon selection: ** Error: bad argument type: consp nil **

 

If you then select a Type or Size first and then go back to the Class list there is no problem. Not sure what this is, But seems to me there is no default set for Class.

Link to comment
Share on other sites

I ran the original example.lsp in post 20 and found that the same problem exists when you select Model first after you first start the program.

Link to comment
Share on other sites

I shall look into it.

Lee,

 

I took a crack at this myself and came up with a so called fix for what it is worth. I do not get the error anymore.

 

This is what I tried:

 

  (Makelist "type"  (mapcar (function car) Data))
 (setq Type  (atoi (set_tile "type" "0")))
 (Makelist "class" (mapcar (function car) (cdar Data)))
 (setq Class (atoi (set_tile "class" "0")))
 (Makelist "size"  (cdadar Data))
 (setq Size  (atoi (set_tile "size" "0")))
 [color="Red"](set_tile "type"  "0")
 (set_tile "class" "0")
 (set_tile "size"  "0")[/color] 

 

I tried this to get the list to remember the last selection, Although I did not get any errors, It did not remember the last selection.:

[color="Red"]  (or Type     (setq Type  0))
 (or Class    (setq Class 0))
 (or Size     (setq Size  0)) [/color]

 

[color="Red"]  (set_tile "type"  (itoa Type))
 (set_tile "class" (itoa Class))
 (set_tile "size"  (itoa Size))[/color] 

 

 

Although this seems to work, I do not have much faith in the fact that I fixed it correctly. Also I tried to take a stab at having the tiles remember their last selection. (Easier said than done) I still do not have the solution.

 

Maybe what I did here could give you a better idea as to what is wrong. All I know is the error is now gone when I select the tile in the middle first. What does not make sense here is the fact that the tiles are set in the previous lines where the list are made with Makelist function.

  (Makelist "type"  (mapcar (function car) Data))
 (setq Type  (atoi [color="Red"](set_tile "type" "0")[/color]))
 (Makelist "class" (mapcar (function car) (cdar Data)))
 (setq Class (atoi [color="red"](set_tile "class" "0")[/color]))
 (Makelist "size"  (cdadar Data))
 (setq Size  (atoi [color="red"](set_tile "size" "0")[/color])) 

 

 

Let me know what you think.

Link to comment
Share on other sites

Hi Buzzard,

 

Things get a little more complex if you wish for the values of the tiles to stay global - as additional error checking is needed to determine whether the tile value points to a valid member of the list.

 

This is how I might approach such a case.

Example.lsp

Example.dcl

Link to comment
Share on other sites

Hi Buzzard,

 

Things get a little more complex if you wish for the values of the tiles to stay global - as additional error checking is needed to determine whether the tile value points to a valid member of the list.

 

This is how I might approach such a case.

I assume the variable with the * are your global variables. I also noticed you put in a function for set_tile. Real Neat!

 

Oh Yuk! I see (vl-load-com). You had to go there. Just kidding Lee.

 

Thanks A lot.

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