JuniorNogueira Posted June 9, 2020 Posted June 9, 2020 (edited) Hello guys i'm a few days trying to find a solution for this: / I would like to create a list_box with the items aligned (similar to the FIND command) but I don't know how to add the header or how to make the items right. Has anyone done something like that that can give me an example ?? Edited June 12, 2020 by JuniorNogueira Quote
rlx Posted June 9, 2020 Posted June 9, 2020 (edited) study : this tabs List Box with Tabs. This attribute specifies the placement of tabs in character width units. Possible value is a quoted string containing integers or floating-point numbers separated by spaces. Default = None. These values are used for vertically aligning columns of text in a 'popup_list' or 'list_box'. DCL Code Sample [code] lisp49af : dialog { //dialog name label = "tabs" ; //give it a label : list_box { //define a list box key = "lb1"; //give it a name label = "Select Bolt Type:"; //give it a label allow_accept = true; //allow double clicking list = "M20\t40LG\tGr. 8,8\n M16\t30LG\tGr. 4,6\n M30\t60LG\tGr. 8,8\n M12\t35LG\tGr. 4,6\n M8\t45LG\tGr. 8,8"; //define the list height = 6; //give it a height fixed_height = true; //fix the height } //end list box ok_cancel ; //predefined OK/Cancel button } //end dialog [/code] Edited June 9, 2020 by rlx 2 Quote
JuniorNogueira Posted June 9, 2020 Author Posted June 9, 2020 (edited) @rlx é isso que eu preciso, mas posso determinar o tamanho da minha guia? para caber no meu cabeçalho ?? Edited June 9, 2020 by JuniorNogueira Quote
rlx Posted June 9, 2020 Posted June 9, 2020 you may have to experiment a little with the values for your tab stops. Code posted above misses the red line with it just says next tab stop is on 8 , 16 and 24 , but you may want to have "4 14 28" , just use code above and change it to fit your needs 1 Quote
pkenewell Posted June 9, 2020 Posted June 9, 2020 4 hours ago, rlx said: it just says next tab stop is on 8 , 16 and 24 , but you may want to have "4 14 28" , just use code above and change it to fit your needs @rlx It looks like the DCL code you posted is missing the [ tabs = "8 16 24"; ] that is present in the original code on AfraLisp. Quote
rlx Posted June 9, 2020 Posted June 9, 2020 yes I already wrote that in my previous post. Pasted the code , it was there , red & all, pressed save and poof.... like sending your wife to town with your creditcard and poof... all your money is gone Quote
pkenewell Posted June 9, 2020 Posted June 9, 2020 Just now, rlx said: yes I already wrote that in my previous post. Pasted the code , it was there , red & all, pressed save and poof.... like sending your wife to town with your creditcard and poof... all your money is gone LOL Ok. I just posted because I wast confused on what you meant until I clicked on the link to the original. Good read though - I haven't used the tabs thing in a while and forgot about it. Quote
rlx Posted June 9, 2020 Posted June 9, 2020 Last week I was writing something and thought , mm, have to write a function able to wblock a list of block names and totally forgot I wrote one before. The worst thing was I wrote it, oh I dunno, one or two months before. If it was like one or two decades, ok , but just a couple of months... think after not having a single day of vacation since 2012 its about time I do so. Maybe not a good time because of all the lockdowns and stuff but I hear Mars is lovely this time a year 1 Quote
JuniorNogueira Posted June 9, 2020 Author Posted June 9, 2020 Thank you!! You helped me a lot! 1 Quote
BIGAL Posted June 9, 2020 Posted June 9, 2020 For anyone like me. missing bit allow_accept = true; //allow double clicking tabs = "8 16 24"; //set tabs list = "M20\t40LG\tGr. 8,8\n Quote
GeneJ Posted September 3, 2022 Posted September 3, 2022 (edited) Am I the only one getting multiple errors whilst trying to open this DCL? Error in dialog file "path\test.dcl", line 9: newline in string constant. Error in dialog file "path\test.dcl", line 10: missing semicolon. Error in dialog file "path\test.dcl", line 10: invalid attribute. Symbol "M16". Error in dialog file "path\test.dcl", line 10: syntax error. Symbol "M16". Edited September 3, 2022 by GeneJ all errors listed Quote
rlx Posted September 4, 2022 Posted September 4, 2022 lisp49af :dialog {label="tabs"; :list_box {key="lb1";label="Select Bolt Type:"; allow_accept=true; tabs="8 16 24"; list="M20\t40LG\tGr. 8,8;\nM16\t30LG\tGr. 4,6;\nM30\t60LG\tGr. 8,8;\nM12\t35LG\tGr. 4,6;\nM8\t45LG\tGr. 8,8"; height=6;fixed_height=true;} ok_cancel; } it seems its important for this code to work everything on line 4 is on the same line alternatively you can pass the list to the dialog thru the lisp program because now the list will always be the same but what if you don't know how long your list is gonna be? look at : https://autolisp-exchange.com/Tutorials/MyDialogs.htm Somewhere in the middle of the page is an example called 'My Multi Lists' //--------------------------------------------------------------------------------------------------------- // MyMultiLists //--------------------------------------------------------------------------------------------------------- MyMultiLists : dialog { key = "Title"; label = ""; : boxed_column { label = "Select an Item"; : list_box { key = "List1";//Value1$ from lsp file height = 6.27; fixed_height = true; width = 32.92; fixed_width = true; } spacer; } : boxed_column { label = "Multi Select Items"; : list_box { multiple_select = true; key = "List2";//Value2$ from lsp file height = 6.27; fixed_height = true; width = 32.92; fixed_width = true; } spacer; } spacer; ok_only; }//MyMultiLists ;---------------------------------------------------------------------------------------------------------- ; c:MyMultiLists - Dialog for list_boxes with single and multi select examples ; Syntax: MyMultiLists ;---------------------------------------------------------------------------------------------------------- (defun c:MyMultiLists (/ Dcl_Id% List1@ List2@ Return# Value1$ Value2$) (princ "\nMyMultiLists")(princ) ; Set Default Variables (if (not *MyMultiLists@);Unique global variable name to store dialog info (setq *MyMultiLists@ (list nil "" "")) );if (setq Value1$ (nth 1 *MyMultiLists@) Value2$ (nth 2 *MyMultiLists@) List1@ (list "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday") List2@ (list "January" "February" "March" "April" "May" "June" "July" "August" "September" "October" "November" "December") );setq ; Load Dialog (setq Dcl_Id% (load_dialog "MyDialogs.dcl")) (new_dialog "MyMultiLists" Dcl_Id%) ; Set Dialog Initial Settings (set_tile "Title" " My Multi Lists") (set_tile_list "List1" List1@ Value1$);*Included (set_tile_list "List2" List2@ Value2$);*Included ; Dialog Actions (action_tile "List1" "(set_list_value \"List1@\" \"Value1$\")");*Included (action_tile "List2" "(set_multilist_value \"List2@\" \"Value2$\")");*Included (setq Return# (start_dialog)) ; Unload Dialog (unload_dialog Dcl_Id%) (setq *MyMultiLists@ (list nil Value1$ Value2$)) (princ) );defun c:MyMultiLists here you have ': list_box { key = "List1"; //Value1$ from lsp file' , which means this listbox will be filled by the program later on The lisp program does so by first creating a list called 'List1@' (setq List1@ (list "Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday") and later it fills the listbox with : (set_tile_list "List1" List1@ Value1$) where Value1$ was set to "" earlier. Just study and play with the examples on the autocad-exchange link , they can do a far better job than me explaining 1 Quote
GeneJ Posted September 4, 2022 Posted September 4, 2022 @rlx thank you for the explanation - I have figured out that each list item needs to consist of individual strings. The example from afralisp therefore wouldn't work. Quote
rlx Posted September 6, 2022 Posted September 6, 2022 There are more roads that lead to Rome... so you can split up strings and later put them back together like is done for example with csv files where you have one string but each element is separated by a comma or something. But that's just the little stuf. Most important is your dialog design and the way it 'flows' and the rest will follow naturally. Quote
Recommended Posts
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.