乐筑天下

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

[编程交流] 列表框,如何突出显示

[复制链接]

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 04:40:04 | 显示全部楼层 |阅读模式
大家好,
 
我决定在我的一个dcl中从popup_列表切换到list_框。我设置了默认值,它们工作正常。我在这里遇到的问题是,当dcl首次出现时,值没有突出显示。我尝试使用value=0;,但这没什么作用,所以我把它去掉了。
 
缺少什么?如果能在这方面得到任何帮助,我将不胜感激。
谢谢
 
  1.              : column {
  2.               : boxed_column {
  3.                 label = "Class";
  4.                 : list_box {
  5.                   key = "CLASS";
  6.                   height = 8.0;
  7.                   width = 9.0;
  8.                   fixed_height = true;
  9.                   fixed_width = true;
  10.                   alignment = centered;
  11.                 }
  12.               }
  13.             }
  14.             : column {
  15.               : boxed_column {
  16.                 label = "Size";
  17.                 : list_box {
  18.                   key = "PSIZ";
  19.                   height = 8.0;
  20.                   width = 9.0;
  21.                   fixed_height = true;
  22.                   fixed_width = true;
  23.                   alignment = centered;
  24.                 }
  25.               }
  26.             }

054009dhlab5yx755g5x8b.jpg
回复

使用道具 举报

4

主题

327

帖子

324

银币

初来乍到

Rank: 1

铜币
19
发表于 2022-7-6 04:46:05 | 显示全部楼层
我认为(mode\u tile key mode)可以做到这一点
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 04:48:40 | 显示全部楼层
谢谢你,约翰,
 
但是mode_互动程序会将注意力集中在互动程序上,而不会突出显示它。
回复

使用道具 举报

4

主题

327

帖子

324

银币

初来乍到

Rank: 1

铜币
19
发表于 2022-7-6 04:51:58 | 显示全部楼层
你想突出某个特定项目,对吗?
我认为你使用set_tile,然后将mode tile设置为mode 3
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 04:55:58 | 显示全部楼层
这适用于编辑框内容,而不是列表框。
回复

使用道具 举报

4

主题

327

帖子

324

银币

初来乍到

Rank: 1

铜币
19
发表于 2022-7-6 04:58:52 | 显示全部楼层
现在,保存dcl和lisp文件,然后在AutoCAD中映射到文件夹的路径,在vlide编辑器中加载文件并运行lisp文件,您将看到列表框中的项目高亮显示。在lisp文件中,您将看到将set\u tile设置为列表中的项目,并将mode tile设置为高亮显示它们。您可以创建变量来记住这些。
 
  1. [font=Times New Roman][font=Times New Roman](defun test:DialogInput[/font]
  2. [font=Times New Roman]      (/ dcl_id result userclick dialogLoaded dialogShow)[/font]
  3. [font=Times New Roman] (setq dialogLoaded T[/font]
  4. [font=Times New Roman]dialogShow   T       [/font]
  5. [font=Times New Roman] ) ;_ end of setq[/font]
  6. [font=Times New Roman] (if (= -1 (setq dcl_id (load_dialog "test.DCL")))[/font]
  7. [font=Times New Roman]   (progn  [/font]
  8. [font=Times New Roman]     (princ "\nERROR: Cannot load test.dcl")[/font]
  9. [font=Times New Roman]     (setq dialogLoaded nil)[/font]
  10. [font=Times New Roman]   ) ;_ end of progn[/font]
  11. [font=Times New Roman] ) ;_ end of if[/font]
  12. [font=Times New Roman] (if (and (not (new_dialog "test_dlg" dcl_id))[/font]
  13. [font=Times New Roman]   dialogLoaded[/font]
  14. [font=Times New Roman]     ) ;_ end of and[/font]
  15. [font=Times New Roman]   (progn     [/font]
  16. [font=Times New Roman]     (princ "\nERROR: Cannot show dialog test.dlg")[/font]
  17. [font=Times New Roman]     (setq dialogShow nil)[/font]
  18. [font=Times New Roman]   ) ;_ end of progn[/font]
  19. [font=Times New Roman] ) ;_ end of if[/font]
  20. [font=Times New Roman] (if (and dialogLoaded dialogShow)[/font]
  21. [font=Times New Roman]   (progn[/font]
  22. [font=Times New Roman]   (setq lst1 '("150" "300" "400" "600" "900" "1500" "2500"))[/font]
  23. [font=Times New Roman]   (setq lst2 '("1/2" "3/4" "1" "1-1/4" "1-1/2" "1-3/4" "2"))[/font]
  24. [font=Times New Roman]  (start_list "CLASS" 3) [/font]
  25. [font=Times New Roman]     (mapcar 'add_list lst1);_[/font]
  26. [font=Times New Roman]     (end_list)[/font]
  27. [font=Times New Roman]   (set_tile "CLASS" "2")[/font]
  28. [font=Times New Roman](mode_tile "CLASS" 3);_[/font]
  29. [font=Times New Roman]      (start_list "PSIZ" 3);_[/font]
  30. [font=Times New Roman]     (mapcar 'add_list lst2)  [/font]
  31. [font=Times New Roman]     (end_list)[/font]
  32. [font=Times New Roman]    (set_tile "PSIZ" "2")[/font]
  33. [font=Times New Roman](mode_tile "PSIZ" 3);_[/font]
  34. [font=Times New Roman]     (action_tile "cancel" "(done_dialog)(setq UserClick nil) ")[/font]
  35. [font=Times New Roman]     (start_dialog)   [/font]
  36. [font=Times New Roman]     (unload_dialog dcl_id)[/font]
  37. [font=Times New Roman]      ;_ end of if[/font]
  38. [font=Times New Roman]   ) ;_ end of progn[/font]
  39. [font=Times New Roman] ) ;_ end of if [/font]
  40. [font=Times New Roman])[/font]
  41. [/font]
  1. test_dlg : dialog {
  2. : row {
  3. : column {
  4.               : boxed_column {
  5.                 label = "Class";
  6.                 : list_box {
  7.                   key = "CLASS";
  8.                   height = 8.0;
  9.                   width = 9.0;
  10.                   fixed_height = true;
  11.                   fixed_width = true;
  12.                   alignment = centered;
  13.                 }
  14.               }
  15.             }
  16.             : column {
  17.               : boxed_column {
  18.                 label = "Size";
  19.                 : list_box {
  20.                   key = "PSIZ";
  21.                   height = 8.0;
  22.                   width = 9.0;
  23.                   fixed_height = true;
  24.                   fixed_width = true;
  25.                   alignment = centered;
  26.                 }
  27.               }
  28.             }
  29.             }
  30. : row {          // defines the OK/Cancel button row
  31. : spacer { width = 1; }
  32. : button {    // defines the OK button
  33.    label = "OK";
  34.    is_default = true;
  35.    key = "accept";
  36.    width = 8;
  37.    fixed_width = true;
  38. }
  39. : button {    // defines the Cancel button
  40.    label = "Cancel";
  41.    is_cancel = true;
  42.    key = "cancel";
  43.    width = 8;
  44.    fixed_width = true;}
  45.    }
  46. }//_end
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 04:59:31 | 显示全部楼层
  1. (set_tile <key> "1")
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 05:03:34 | 显示全部楼层
谢谢李,
 
但它没有做任何事情。我使用单选按钮设置类列表的值,类列表依次设置大小列表的值。最初的问题是,当对话框第一次启动时,没有按照默认设置突出显示每个列表中的第一个值。
 
选择后,这些值将高亮显示,并在对话框重新出现时记住其上次选择。
 
我不经常使用列表框,但在这种情况下,这似乎是一个很好的改变。男孩,我错了。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 05:05:36 | 显示全部楼层
Buzzard,这并不太难,列表框的工作方式与popup_列表相同(哦,它应该是“0”)
 
例如:
 
  1. (defun c:test ( / dc f lst item )
  2. (cond
  3.    (
  4.      (or
  5.        (<= (setq dc (load_dialog "ListBox.dcl")) 0)
  6.        (not (new_dialog "test" dc))
  7.      )
  8.    )
  9.    (t
  10.      (start_list "lst")
  11.      (mapcar (function add_list) (setq lst '("Item1" "Item2" "Item3")))
  12.      (end_list)
  13.      (setq item (set_tile "lst" "0"))
  14.      (action_tile "lst" "(setq item $value)")
  15.      (setq f (start_dialog) dc (unload_dialog dc))
  16.      (if (= f 1)
  17.        (alert
  18.          (strcat "You Selected: "
  19.            (nth (atoi item) lst)
  20.          )
  21.        )
  22.      )
  23.    )
  24. )
  25. (princ)
  26. )

 
大小现在突出显示,但不是类。
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 05:09:09 | 显示全部楼层
我只设置变量,以便在用户点击OK之前没有选择任何项目时,变量具有tile_值。
 
set\u tile语句是突出显示列表框项的函数-不会有太多错误。
054011nvl3j69a51jt51ku.jpg
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:27 , Processed in 1.214999 second(s), 75 queries .

© 2020-2025 乐筑天下

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