乐筑天下

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

[编程交流] 下拉选项

[复制链接]

1

主题

316

帖子

311

银币

初来乍到

Rank: 1

铜币
29
发表于 2022-7-6 15:46:53 | 显示全部楼层
 
flowerrobot,我不知道你说的“自己弹出”而不是“箭头”是什么意思。至于没有进入超过11个选项的命令行的提示,我认为最好解决一个对话框。
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 15:51:41 | 显示全部楼层
 
我支持这个-
 
我非常怀疑有没有一种方法可以使下拉列表独立地下拉,而对话框可以让事情变得更清楚。
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 15:54:56 | 显示全部楼层
如果您需要一个包含选项列表的对话框,欢迎您使用。我不久前写了它,用于快速选择列表框。
 
  1. ;list select dialog
  2. ;create a temp DCL multi-select list dialog from provided list
  3. ;value is returned in list form, DCL file is deleted when finished
  4. ;example: (setq the_list (AT:listselect "This is my list title" "Select items to make a list" "25" "30" "true" (list "object 1" "object 2" "object 3"))
  5. ;if mytitle is longer than defined width, the width will be ignored and it will fit to title string
  6. ;if mylabel is longer than defined width, mylabel will be truncated
  7. ;myheight and mywidth must be strings, not numbers
  8. ;mymultiselect must either be "true" or "false" (true for multi, false for single)
  9. ;created by: alan thompson, 9.23.08
  10. ;some coding borrowed from http://www.jefferypsanders.com (thanks for the DCL examples)
  11. (defun AT:listselect  ( mytitle       ;title for dialog box
  12.            mylabel       ;label right above list box
  13.            myheight      ;height of dialog box !!*MUST BE STRING*!!
  14.            mywidth       ;width of dialog box !!*MUST BE STRING*!!
  15.            mymultiselect ;"true" for multiselect, "false" for single select
  16.            mylist        ;list to display in list box
  17.            / retlist readlist count item savevars fn fo valuestr dcl_id )
  18. (defun saveVars(/ readlist count item)
  19. (setq retList(list))
  20. (setq readlist(get_tile "mylist"))
  21. (setq count 1)
  22. (while (setq item (read readlist))
  23.    (setq retlist(append retList (list (nth item myList))))
  24.    (while
  25.      (and
  26.        (/= " " (substr readlist count 1))
  27.        (/= ""   (substr readlist count 1))
  28.      )
  29.      (setq count (1+ count))
  30.    )
  31.    (setq readlist (substr readlist count))
  32. )
  33. );defun
  34. (setq fn (vl-filename-mktemp "" "" ".dcl"))
  35. (setq fo (open fn "w"))
  36. (setq valuestr (strcat "value = "" mytitle "";"))
  37. (write-line (strcat "list_select : dialog {
  38.            label = "" mytitle "";") fo)
  39. (write-line
  40. (strcat "          : column {
  41.            : row {
  42.              : boxed_column {
  43.               : list_box {
  44.                  label ="" mylabel "";
  45.                  key = "mylist";
  46.                  allow_accept = true;
  47.                  height = " myheight ";
  48.                  width = " mywidth ";
  49.                  multiple_select = " mymultiselect ";
  50.                  fixed_width_font = false;
  51.                  value = "0";
  52.                }
  53.              }
  54.            }
  55.            : row {
  56.              : boxed_row {
  57.                : button {
  58.                  key = "accept";
  59.                  label = " Okay ";
  60.                  is_default = true;
  61.                }
  62.                : button {
  63.                  key = "cancel";
  64.                  label = " Cancel ";
  65.                  is_default = false;
  66.                  is_cancel = true;
  67.                }
  68.              }
  69.            }
  70.          }
  71. }") fo)
  72. (close fo)
  73. (setq dcl_id (load_dialog fn))
  74. (new_dialog "list_select" dcl_id)
  75. (start_list "mylist" 3)
  76. (mapcar 'add_list myList)
  77. (end_list)
  78. (action_tile "cancel" "(setq ddiag 1)(done_dialog)")
  79. (action_tile "accept" "(setq ddiag 2)(saveVars)(done_dialog)")
  80. (start_dialog)
  81. (if (= ddiag 1)
  82.     (setq retlist nil)
  83. )
  84. (unload_dialog dcl_id)
  85. (vl-file-delete fn)
  86. retlist
  87. );defun
回复

使用道具 举报

41

主题

301

帖子

265

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
209
发表于 2022-7-6 15:58:24 | 显示全部楼层
谢谢你的剧本,
 
的确,这可能是一个很好的选择,如果我错了,请纠正我。
但我试图创建的是,你要么输入intiger,要么输入一个关键字,我在命令行和“(command“textscr”)上都弹出,然后在输入后删除它,但正在考虑删除弹出窗口,并将该列表下拉(动态输入)。但如果我用那个拨号框,这意味着它更难输入一个dosnt吗?我正试图用尽可能少的输入来制作程序
这是第一份菜单。
 
我希望你明白我的意思
谢谢你堆

 
 
  1. (defun menuoptions ()
  2. (if (= mass nil)(setq Mass 0.00000785))                        ;End if
  3. (if (= mass 0.00000818)(setq masstype "316 S.S."))                    ;End if
  4. (if (= mass 0.00000785)(setq masstype "MILD STEEL"))                    ;End if
  5. (if (= mass 0.0000078029)(setq masstype "SAF 3402"))                    ;End if
  6. (if (= masli nil)(setq masli "YES"))                                    ;End if
  7. ;--------------------------------settings------------------------------------
  8. (cond
  9.    ((= "AU" sectionlocation)
  10.     (princ "\n-----AUSTRALIAN SECTIONS------"))
  11.    ((= "C" sectionlocation)
  12.     (princ "\n------CANADIAN SECTIONS------"))
  13.    ((= "AM" sectionlocation)
  14.     (princ "\n------AMERICAN SECTIONS-------"))
  15.    ((= "S" sectionlocation)
  16.     (princ "\n------SOUTH AFRICAN SECTIONS------"))
  17.    )
  18. (princ "\n<SE>  = SETTINGS, ALLOWS YOU TO SET MASS PROPERTIES")
  19. (princ "\n<N>   = SET ITEM NUMBER")
  20. (princ "\n<M>   = TOGGLE MASS BOX INSERTION ON/OFF")
  21. (princ "\n<C>   = CONE PROGRAM, FINDS OUT WEIGHT OF A CONE")
  22. (princ "\n<D>   = FOR PIPE OR FLANGE SIZES")
  23. (princ "\n<CU>  = CUSTOM FLANGE")
  24. ; CHANGES DEPENDING ON SETTING FOR CAN AMERICAN OR SA SECTIONS
  25. (if (= nil sectionlocation)
  26.    (setq sectionlocation "AU")
  27. )
  28. (cond
  29.        ((= "AU" sectionlocation)
  30.            (progn
  31.              (princ "\n<E>   = EQUAL ANGLE")
  32.              (princ "\n<U>   = UNEQUAL ANGLES")
  33.              (princ "\n<P>   = PFC")
  34.              (princ "\n<B>   = UNVERSAL BEAM")
  35.              (princ "\n<UC>  = UNVERSAL COLUMN")
  36.              (princ "\n<NA>  = NON-AUSTRLIAN SECTION")
  37.             )
  38.        )
  39.        ((OR (= "AM" sectionlocation)(= "C" sectionlocation))
  40.            (progn
  41.                (princ "\n<W>   = 'W'  TYPE BEAM")
  42.                (princ "\n<H>   = 'HP' TYPE BEAM")
  43.                (princ "\n<MM>  = 'M'  TYPE BEAM")
  44.                (princ "\n<S>   = 'S'  TYPE BEAM")
  45.                (princ "\n<MC>  = 'MC' TYPE BEAM")
  46.                (princ "\n<CC>   = CHANNEL")
  47.                (princ "\n<A>   = ANGLE")
  48.            )
  49.        )
  50.        ;((= "C" sectionlocation) THE CAN IS THE SAME AS THE AMERICAN ONE,
  51.        ((= "S" sectionlocation)
  52.            (progn
  53.                (princ "\n<W>   = 'W'  TYPE BEAM")
  54.                (princ "\n<H>   = 'HP' TYPE BEAM")
  55.                (princ "\n<MM>  = 'M'  TYPE BEAM")
  56.                (princ "\n<S>   = 'S'  TYPE BEAM")
  57.                (princ "\n<MC>  = 'MC' TYPE BEAM")
  58.                (princ "\n<C>   = CHANNEL")
  59.                (princ "\n<A>   = ANGLE")
  60.            )
  61.        )
  62. )
  63.       
  64. (princ "\nWelcome To weight calc ")
  65. (if (= masli "YES")
  66. (princ "\nYou currently want Mass box insertion ON")
  67. (princ "\nYou currently want Mass box insertion OFF")
  68. )
  69. (princ "\nCurrent Metal is : ")(princ Masstype)
  70. (command "textscr")
  71. (initget 7 "SE C N D E U P B UC NA CU M W H MM S MC CC A")
  72. (setq    mp1 (getdist "\nENTER WIDTH PLATE, or key for options : "))
  73. (command "graphscr")
  74. )
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-5-31 11:49 , Processed in 0.405433 second(s), 69 queries .

© 2020-2025 乐筑天下

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