TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: well20152016 on January 16, 2018, 12:09:12 PM
-
(defun LM:PadBetween ( s1 s2 ch ln )
(if (< (+ (strlen s1) (strlen s2)) ln)
(LM:PadBetween (strcat s1 ch) s2 ch ln)
(strcat s1 s2)
)
)
(defun c:test()
(setq lst (list "asd" "该i家" "该i家该i家" "该i家家"))
;;; (setq lst (list "asd" "dhfdd" "dfaxcghh" "yyyxx"))
(setq lst (mapcar '(lambda (x) (list x (itoa (strlen x)))) lst)
nn (+ 10 (apply 'max (mapcar '(lambda (x) (strlen (strcat (car x)) (cadr x))) lst)))
str (mapcar '(lambda (x) (princ "\n")(princ (LM:PadBetween (car x) (cadr x) " " nn))) lst))
(if (> (setq dcl_id (load_dialog "test.DCL")) 0)
(progn
(if (new_dialog "test" dcl_id) (progn
(MTL:DCL-addlist "lll" str 0)
(setq ok (start_dialog))
) )
(unload_dialog dcl_id)
) )
(princ))
-
Try setting the fixed_width_font attribute of the list_box tile to true.
-
non ascii characters are hard to deal with
just use "\t" as a delimiter and set "tabs" attribute in your dcl
-
VovKa, could you show an example of using 'tabs'? I tried to use '\t' at popup_list and list_box, but i didn't see the correct result. Thanks.
-
VovKa, could you show an example of using 'tabs'? I tried to use '\t' at popup_list and list_box, but i didn't see the correct result. Thanks.
if the problem is that columns with numbers are not aligned to the right then "tabs" will not fix that issue
test:dialog {
label = "test" ;
:column {
:list_box {
key = "lll" ;
width = 30 ;
tabs = "10 14";
tab_truncate = true;
}
cancel_button;
}
}
(defun c:test ()
(setq lst (list "1\t10\t100" "10\t100\t1000" "100\t1000\t10000""1000\t10000\t100000"))
(if (> (setq dcl_id (load_dialog "test.DCL")) 0)
(progn (if (new_dialog "test" dcl_id)
(progn (start_list "lll")
(mapcar 'add_list lst)
(end_list)
(setq ok (start_dialog))
)
)
(unload_dialog dcl_id)
)
)
)
-
Here (http://lee-mac.com/batte.html) is an example of an application which uses tabs to align list box records into columns, without using a fixed width font.
-
Jesus! Thank you, guys! You make my life comfortable!
-
Thank you, Friends!
-
Thanks here too. Cleaned up my filter routine dialog quite a bit. ( based on MP's getvlaatoms ) I definitely stand on the shoulders of giants. :yes:
-
Hey Ron,
any room up there on the shoulders?
Care to share your filter selection by?
Cheers, Rod
-
Sure ... I'll need to do a bit of housecleaning on the code first though.
-
Looks good Ron :-)
-
Looks good Ron :)
Thanks! :)