;; | ---------------------------------------------------------------------------- ;; | DL_FitPathInTextBox ;; | ---------------------------------------------------------------------------- ;; | Function : Appropriately edit the file (with path) string such that it ;; | fits into a text box area of given width ;; | Arguments : ;; | 'Txt' - File path text string to fit ;; | 'Len' - Width of text box ;; | Author : Rakesh Rao, (C) Rakesh Rao, Bangalore ;; | Updated : June 14, 2008 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ----------------------------------------------------------------------------- (defun DL_FitPathInTextBox ( Txt Len / _len tmp fn path RetStr __len ) (setq retStr "" _len (strlen Txt) tmp (MI_SplitPath Txt) fn (nth 0 tmp) path (nth 1 tmp) ) (if (>= (setq __len (strlen fn)) Len) (progn (setq tmp (- __len Len)) (if (= tmp 0) (setq tmp 1) ) (setq retStr (substr fn tmp)) ) (progn (if (>= (setq __len (strlen Txt)) Len) (progn (setq tmp (- __len Len)) (if (= tmp 0) (setq tmp 1) ) (setq retStr (substr Txt tmp)) ) (setq retStr Txt) ) )) retStr )