Author Topic: dcl No alignment  (Read 4552 times)

0 Members and 1 Guest are viewing this topic.

well20152016

  • Newt
  • Posts: 130
dcl No alignment
« 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))
« Last Edit: January 16, 2018, 12:20:10 PM by well20152016 »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: dcl No alignment
« Reply #1 on: January 16, 2018, 12:36:03 PM »
Try setting the fixed_width_font attribute of the list_box tile to true.

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: dcl No alignment
« Reply #2 on: January 16, 2018, 12:43:53 PM »
non ascii characters are hard to deal with
just use "\t" as a delimiter and set "tabs" attribute in your dcl

kpblc

  • Bull Frog
  • Posts: 396
Re: dcl No alignment
« Reply #3 on: January 17, 2018, 12:16:15 AM »
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.
Sorry for my English.

VovKa

  • Water Moccasin
  • Posts: 1626
  • Ukraine
Re: dcl No alignment
« Reply #4 on: January 17, 2018, 05:03:54 AM »
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
Code: [Select]
test:dialog {
    label = "test" ;
    :column {
        :list_box {
            key = "lll" ;
            width = 30 ;
            tabs = "10 14";
            tab_truncate = true;
        }
        cancel_button;
    }
}

Code: [Select]
(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)
    )
  )
)

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: dcl No alignment
« Reply #5 on: January 17, 2018, 08:01:42 AM »
Here is an example of an application which uses tabs to align list box records into columns, without using a fixed width font.

kpblc

  • Bull Frog
  • Posts: 396
Re: dcl No alignment
« Reply #6 on: January 17, 2018, 01:35:12 PM »
Jesus! Thank you, guys! You make my life comfortable!
Sorry for my English.

well20152016

  • Newt
  • Posts: 130
Re: dcl No alignment
« Reply #7 on: January 17, 2018, 07:35:59 PM »
Thank you, Friends!

ronjonp

  • Needs a day job
  • Posts: 7526
Re: dcl No alignment
« Reply #8 on: January 17, 2018, 08:35:56 PM »
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:


Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Rod

  • Newt
  • Posts: 185
Re: dcl No alignment
« Reply #9 on: January 17, 2018, 11:19:26 PM »
Hey Ron,

any room up there on the shoulders?

Care to share your filter selection by?

Cheers, Rod
"All models are wrong, some models are useful" - George Box

ronjonp

  • Needs a day job
  • Posts: 7526
Re: dcl No alignment
« Reply #10 on: January 18, 2018, 09:57:47 AM »
Sure ... I'll need to do a bit of housecleaning on the code first though.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: dcl No alignment
« Reply #11 on: January 18, 2018, 01:25:06 PM »
Looks good Ron  :-)

ronjonp

  • Needs a day job
  • Posts: 7526
Re: dcl No alignment
« Reply #12 on: January 18, 2018, 02:20:20 PM »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC