;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; for CoCreate SolidDesigner ;; Description: ;; display a list of strings (e.g. obj-pathnames after multiple selection) ;; with the help of the general text editor ;; ;; Reference : https://ww3.cad.de/foren/ubb/Forum29/HTML/003611.shtml#000009 ;; Docu : https://support.ptc.com/help/creo_elements_direct/r20.5.0.0/advanced_documentation/integration_kit/reference/ui_util.html#sd-show-general-text-editor ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Filename : cadde-29-003611.lsp ;; Version : 1.1 use sd-show-general-text-editor for long lists ;; 1.0 use GUI value up to a certain number of selected elements ;; Created : Fri Sep 2 20:30:50 CEST 2022 ;; Modified : Sat Sep 3 13:45:04 CEST 2022 ;; Author : der_Wolfgang@forum@cad.de ;; Download : cad.de ;; SD-Version : developed with PE80 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :cadde-wt) (use-package :OLI) (sd-defdialog 'sd_show_string_list :dialog-title '(sd-multi-lang-string "Demo: display string list" :german "Demo: Liste von Zeichenketten anzeigen") ; german giggle :toolbox-button :force :variables '( ("Demo: display x elements selected") (parts :selection (*sd-assembly-seltype* *sd-part-seltype*) :multiple-items t :show-select-menu t :title (sd-multi-lang-string "Parts/Assemblies" :german "Teile/Baugruppen") :gui-value (if (> (length parts) 4) (format nil (sd-multi-lang-string "~D selected" :german "~D gewählt") (length parts)) (format nil "~{~S~^ ~}" (mapcar 'sd-inq-obj-pathname parts)) ) :before-input (sd-hide-string-list) :after-input (let ((obj-names (sort (mapcar 'sd-inq-obj-pathname parts) 'string<)) ; (remove-duplicates parts ... )) ;; just contents only.. ) (when (> (length parts) 3) (sd-show-string-list obj-names :position nil) ; pos :je-nach-gusto-aber-fuer-die-demo-egal ) ) ) ) :cleanup-action '(sd-hide-string-list) ) ;; end + dialog for testing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; show a list of strings (original == obj pathnames) in the text-editor ;; just to have a better look on all the things.. ;; * it's a kind of read-only editor :-D ;; * the size is optimized and tries to avoid scroll bars within certain ;; maximum sizes (see row+columns in IKIT docu and below) ;; ;; alternative: create a real read-only text widget with the help of UICT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun sd-show-string-list (str-list &key (title (sd-multi-lang-string "Object List" :german "Objekt Liste")) position) (let ((max-length (car (sort (mapcar 'length (remove-if-not 'stringp str-list)) '>))) ) (unless (integerp max-length) (setq max-length 1)) ;; damned weird list we got! ;(pprint (format nil "~{~A~^|~}~%~D~%" str-list max-length)) (sd-show-general-text-editor :title title :initialText (format nil "~{ ∙ ~S~%~}" str-list) :position position :doneAction nil :clearAction nil :userAction nil ; do nothing :resizable T :rows (min 42 (max 15 (+ (length str-list) 1))) :columns (min 142 (max 25 (+ max-length 10))) ) ) ) (defun sd-hide-string-list()(sd-hide-general-text-editor :ignorePin T))