乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 60|回复: 4

[编程交流] list_box

[复制链接]

5

主题

21

帖子

16

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-5 23:27:56 | 显示全部楼层 |阅读模式
Hi
 
i'm trying to get a list to the left of the .sld files now i could ad the list_box to the correct place. but i cant get it to work. i dont know what i need to type in at key.
 
i found this code at web2.airmail.net/terrycad/AutoLISP-Code.htm
blk_lib.lsp
blk_lib.dcl the dcl file i have modified.
 
  1. //------------------------------------------------------------------------------// Dwg_Blks [Drawing Blocks] - View and select drawing blocks//------------------------------------------------------------------------------Dwg_Blks : dialog { label = ""; key = "title"; initial_focus = "cancel"; spacer; : row {   : column {     : list_box {       label ="";       key = "???";       height = 50;       width = 25;       multiple_select = false;       fixed_width_font = true;       value = "";     }   }   : column {     : row {       : icon_image {         key = "sld1";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld2";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld3";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld4";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld5";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }     }     : row {       : column {         : text {           key = "sld1text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld2text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld3text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld4text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld5text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }     }     : row {       : icon_image {         key = "sld6";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld7";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld8";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld9";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld10";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }     }     : row {       : column {         : text {           key = "sld6text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld7text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld8text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld9text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld10text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }     }     : row {       : icon_image {         key = "sld11";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld12";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld13";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld14";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld15";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }     }     : row {       : column {         : text {           key = "sld11text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld12text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld13text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld14text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld15text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }     }     : row {       : icon_image {         key = "sld16";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld17";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld18";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }       : icon_image {         key = "sld19";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }        : icon_image {         key = "sld20";         width = 25.92;         height = 7.97;         aspect_ratio = 1;       }     }     : row {       : column {         : text {           key = "sld16text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld17text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld18text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld19text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }       }       : column {         : text {           key = "sld20text";           label = "";           width = 25.92;           fixed_width = true;           alignment = centered;         }        }     }   } } : row {   : column {     : button {       key   = "previous";       label = "< Previous";       mnemonic = "P";       width = 70;       fixed_width = true;       alignment = centered;     }     : ok_button {       mnemonic = "O";       alignment = right;       width = 11;     }   }   : column {     : button {       key   = "next";       label = "Next >";       mnemonic = "N";       width = 70;       fixed_width = true;       alignment = centered;     }     : cancel_button {       mnemonic = "C";       alignment = left;       width = 11;     }   } }}//Dwg_Blks
so this part of dcl i have changed.
now i would like to get in the list box a list of all files that are displayed as .sld on that part of the library
 
do i need to make changes also to the .lsp file cause i searched and tried some different names as key but none show me a list or even a word
 
thx in advance
回复

使用道具 举报

35

主题

2471

帖子

2447

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
174
发表于 2022-7-5 23:49:40 | 显示全部楼层
To list the SLD files should look to VL-DIRECTORY-FILES function.
  1. (vl-directory-files "C:\\MySLDLibrary\" "*.SLD" 0)
 
Please post the AutoLISP code along to get an apropriate answer.
回复

使用道具 举报

5

主题

21

帖子

16

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 00:03:05 | 显示全部楼层
 
hi
 
I edited my first one now the site should work where to get those files.
i cant past the code in here cause it is to long.
 
with those 3 codes it should work, the program
now i don't realy onderstand where to add your part
also each part of the library loads his own .def and .sld file at the location where the .dwg stands
 
 
its a verry nice tool that library but it need some tweeking for me.
am also looking to adjust some default values.
but that is for afhter this qeust
回复

使用道具 举报

28

主题

317

帖子

292

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
140
发表于 2022-7-6 00:14:24 | 显示全部楼层
To use a listbox, you need a key. In the DCL file, the only thing you specify is which key should be used. The key however has to be defined into the lisp.
To define a key you need the following functions
(start_list key)
(add_list)
...
(end_list)
 
 
Many made simple sub routines to help, I've seen (one by MSasu and Lee Mac..)
This one is simple and understandable even for beginners (posted by Lee originally me think... )
  1. (defun FillPopupList ( key lst )       (start_list key)       (foreach item lst (add_list item))       (end_list))

 
 
If you want to change the lock (key in DCL), you'll need to make new key (and ideally get rid of unused one). Look and search you'll find 95% of what you need.
 
 
Good luck
回复

使用道具 举报

5

主题

21

帖子

16

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 00:31:25 | 显示全部楼层
 
I'm i right that tis part is controlling the dcl part with the list
 
 

[code] ;----------------------------------------------------------------------------- ; Dwg_Blks: - Controls dialog Dwg_Blks.dcl to view select drawing blocks. ;----------------------------------------------------------------------------- (defun Dwg_Blks: (LibTitle$ DefFile$ / Attribs$ AttribsList@ BlkList@ Block$     BlockLen# Option# Cnt# Dcl_Id% EOF Explode$ ExplodeList@ Field# FileName%     ImageName$ Item$ Layer$ LayerList@ Mid$ No_Blks# No_Pages# PathBlock$     PathFile$ Pg_No# Pick Point@ PointList@ Q$ Ref# Rep# ScaleList@ Scale~     SlideRef$ StartNo# Text$ UserPoint@ UserScale~   );variables   ;---------------------------------------------------------------------------   ; Get Lists from DefFile$.   ;---------------------------------------------------------------------------   (if (setq PathFile$ (findfile (strcat "C:\\Custom\\Blk_Sld\\" DefFile$)))     (setq FileName% (open PathFile$ "r"))     (progn       (GetOK (strcat LibTitle$ " Library")         (strcat DefFile$ " file not found.") "AlertX"       );GetOK       (exit)     );progn   );if   (setq Q$ "\"")   (setq EOF nil)(setq Item$ "")   (while (null EOF)     (setq Text$ (read-line FileName%))     (if Text$       (if (= (substr Text$ 1 1) Q$)         (progn           (setq StartNo# 2)           (setq Cnt# 1)           (setq Field# 1)           (while (and (
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-11 00:07 , Processed in 0.801493 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表