乐筑天下

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

[编程交流] 单选按钮

[复制链接]

145

主题

590

帖子

446

银币

中流砥柱

Rank: 25

铜币
725
发表于 2022-7-6 14:15:09 | 显示全部楼层 |阅读模式
我有一个关于对话框单选按钮的问题。每个对话框是否限制一组单选按钮。我想选择两个项目,但我不想使用单选按钮和切换框。每当我尝试输入多组单选按钮时,就会出现错误。
谢谢
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 14:30:18 | 显示全部楼层
不,你可以有多组单选按钮-只需将每组放在不同的“类别”(想不出正确的术语)。
 
例如:
http://www.cadtutor.net/forum/showthread.php?t=33919
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 14:48:32 | 显示全部楼层
 
我用了你的samp4。dcl和samp4。以lsp为例,添加另一列单选按钮。
 
DCL
  1. samp4 : dialog {                               //*dialog name
  2.        label = "Existing Storm Sewers" ;      //*give it a label
  3. [color=red]       : row {                                //*define row[/color]
  4. [color=red]         : column {                           //*define column[/color]
  5.            : boxed_radio_column {             //*define radio column
  6.              label = "Choose a Type" ;        //*give it a label
  7.              : radio_button {                 //*define radio_button
  8.                key = "T1";                    //*give it a name
  9.                label = "Type 1";              //*give it a label
  10.              }                                //*end radio_button
  11.              : radio_button {                 //*define radio_button
  12.                key = "T2";                    //*give it a name
  13.                label = "Type 2";              //*give it a label
  14.              }                                //*end radio_button
  15.              : radio_button {                 //*define radio_button
  16.                key = "T3";                    //*give it a name
  17.                label = "Type 3";              //*give it a label
  18.              }                                //*end radio_button
  19.              : radio_button {                 //*define radio_button
  20.                key = "T4";                    //*give it a name
  21.                label = "Type 4";              //*give it a label
  22.              }                                //*end radio_button
  23.            }                                  //*end boxed_radio_column
  24. [color=red]         }                                    //*end column[/color]
  25. [color=red]         : column {                           //*define column[/color]
  26. [color=red]           : boxed_radio_column {             //*define radio column[/color]
  27. [color=red]             label = "Choose a Whatever" ;    //*give it a label[/color]
  28. [color=red]             : radio_button {                 //*define radio_button[/color]
  29. [color=red]               key = "W1";                    //*give it a name[/color]
  30. [color=red]               label = "Whatever 1";          //*give it a label[/color]
  31. [color=red]             }                                //*end radio_button[/color]
  32. [color=red]             : radio_button {                 //*define radio_button[/color]
  33. [color=red]               key = "W2";                    //*give it a name[/color]
  34. [color=red]               label = "Whatever 2";          //*give it a label[/color]
  35. [color=red]             }                                //*end radio_button[/color]
  36. [color=red]             : radio_button {                 //*define radio_button[/color]
  37. [color=red]               key = "W3";                    //*give it a name[/color]
  38. [color=red]               label = "Whatever 3";          //*give it a label[/color]
  39. [color=red]             }                                //*end radio_button[/color]
  40. [color=red]             : radio_button {                 //*define radio_button[/color]
  41. [color=red]               key = "W4";                    //*give it a name[/color]
  42. [color=red]               label = "Whatever 4";          //*give it a label[/color]
  43. [color=red]             }                                //*end radio_button[/color]
  44. [color=red]           }                                  //*end boxed_radio_column[/color]
  45. [color=red]         }                                    //*end column[/color]
  46. [color=red]       }                                      //*end row[/color]
  47.        ok_cancel ;                            //*predifined OK/Cancel
  48.        : row {                                //*define row
  49.          : paragraph {                        //*define paragraph
  50.            : text_part {                      //*define text
  51.              label = "Designed by BD";        //*give it some text
  52.            }                                  //*end text
  53.            : text_part {                      //*define more text
  54.              label = "for CCC NNRDO";         //*some more text
  55.            }                                  //*end text
  56.          }                                    //*end paragraph
  57.        }                                      //*end row
  58.      }                                        //*end dialog

LSP
  1. (defun C:samp4 (/ hole) ;define function
  2. (setq dcl_id (load_dialog "samp4.dcl")) ;load dialog
  3. (if
  4.    (not (new_dialog "samp4" dcl_id) ;test for dialog
  5.    );not
  6.    (progn
  7.      (alert "Can not find your dcl file")
  8.      (exit) ;exit if no dialog
  9.    )
  10. );if
  11. (set_tile "T1" "1")   ;Set radio_button T1 as default
  12. [color=red](set_tile "W1" "1")   ;Set radio_button W1 as default[/color]
  13. (setq hole "TB1")     ;Set variable hole to TB1 as default
  14. [color=red](setq Whatever "WB1") ;Set variable whatever to WB1 as default[/color]
  15. (action_tile "T1" "(setq hole "TB1")") ;*store hole type
  16. (action_tile "T2" "(setq hole "TB2")") ;*store hole type
  17. (action_tile "T3" "(setq hole "TB3")") ;*store hole type
  18. (action_tile "T4" "(setq hole "TB4")") ;*store hole type
  19. [color=red](action_tile "W1" "(setq whatever "WB1")") ;*store whatever[/color]
  20. [color=red](action_tile "W2" "(setq whatever "WB2")") ;*store whatever[/color]
  21. [color=red](action_tile "W3" "(setq whatever "WB3")") ;*store whatever[/color]
  22. [color=red](action_tile "W4" "(setq whatever "WB4")") ;*store whatever[/color]
  23. (action_tile "cancel" ;if cancel button pressed
  24.   "(done_dialog)(setq userclick nil)" ;close dialog, set flag
  25. );action_tile
  26. (action_tile "accept" ;if O.K. pressed
  27.   "(done_dialog)(setq userclick T))" ;??? Is this standard code.
  28. );action tile
  29. (start_dialog) ;start dialog
  30. (unload_dialog dcl_id) ;unload
  31. (if userclick                        ;When OK button is selected
  32.    (cond                              ;And one of the following conditions apply
  33.      ((= hole "TB1")(C:ESS1500))      ;If TB1 selected, Go to C:ESS1500
  34.      ((= hole "TB2")(C:ESS1350))      ;If TB2 selected, Go to C:ESS1350
  35.      ((= hole "TB3")(C:ESS1200))      ;If TB3 selected, Go to C:ESS1200
  36.      ((= hole "TB4")(C:ESS1050))      ;If TB4 selected, Go to C:ESS1050
  37.     ;(t (princ "\nNothing changed.")) ;_ end of optional else condition
  38.    )                                  ;End cond
  39. )                                    ;End if
  40. (princ)                              ;Exit quietly
  41. )                                      ;End defun
  42. (princ "\nThis loaded fine")
  43. (princ)
  44. ;;;;;;;;;;Existing Storm_Sewer 1500mm;;;;;;;;;; Start
  45. (defun C:ESS1500()
  46. (setq a "CCC_DR_1500")
  47. (if (= (tblsearch "ltype" a) nil)  
  48.       (command "-linetype" "l" a "acadiso.lin" "")
  49.             (princ))
  50. (graphscr)
  51. (command "._-layer" "N" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1500"
  52.                      "M" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1500"
  53.                      "L" "CCC_DR_1500"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1500"
  54.                      "C"  "84"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1500"
  55.                      "LW" "0.3" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1500" "" )
  56. (command "pline" pause "width" "0.0" "0.0" pause "width" "0.0" "0.0")
  57. (princ)
  58. )
  59. ;;;;;;;;;;Existing Storm_Sewer 1500mm;;;;;;;;;; End
  60. ;;;;;;;;;;Existing Storm_Sewer 1350mm;;;;;;;;;; Start
  61. (defun C:ESS1350()
  62. (setq a "CCC_DR_1350")
  63.    (if (= (tblsearch "ltype" a) nil)  
  64.      (command "-linetype" "l" a "acadiso.lin" "")
  65.             (princ))
  66. (graphscr)
  67. (command "._-layer" "N"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1350"
  68.                      "M"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1350"
  69.                      "L"  "CCC_DR_1350"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1350"
  70.                      "C"  "84" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1350"
  71.                      "LW" "0.3"   "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1350" "" )
  72. (command "pline" pause "width" "0.0" "0.0" pause "width" "0.0" "0.0")
  73. (princ)
  74. )
  75. ;;;;;;;;;;Existing Storm_Sewer 1350mm;;;;;;;;;; End
  76. ;;;;;;;;;;Existing Storm_Sewer 1200mm;;;;;;;;;; Start
  77. (defun c:ESS1200()
  78. (setq a "CCC_DR_1200")
  79. (if (= (tblsearch "ltype" a) nil)  
  80.       (command "-linetype" "l" a "acadiso.lin" "")
  81.             (princ))
  82. (graphscr)
  83. (command "._-layer" "N"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1200"
  84.                      "M"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1200"
  85.                      "L"  "CCC_DR_1200"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1200"
  86.                      "C"  "84" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1200"
  87.                      "LW" "0.3" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1200" "" )
  88. (command "pline" pause "width" "0.0" "0.0")
  89. (princ)
  90. )
  91. ;;;;;;;;;;Existing Storm_Sewer 1200mm;;;;;;;;;; End
  92. ;;;;;;;;;;Existing Storm_Sewer 1050mm;;;;;;;;;; Start
  93. (defun c:ESS1050()
  94. (setq a "CCC_DR_1050")
  95. (if (= (tblsearch "ltype" a) nil)  
  96.       (command "-linetype" "l" a "acadiso.lin" "")
  97.             (princ))
  98. (graphscr)
  99. (command "._-layer" "N"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1050"
  100.                      "M"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1050"
  101.                      "L"  "CCC_DR_1050"  "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1050"
  102.                      "C"  "84" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1050"
  103.                      "LW" "0.3" "CCC_SERVICES_EXISTING_Drainage_Storm_Sewer_1050" "" )
  104. (command "pline" pause "width" "0.0" "0.0")
  105. (princ)
  106. )
  107. ;;;;;;;;;;Existing Storm_Sewer 1050mm;;;;;;;;;; End

 
所有更改均为红色。
回复

使用道具 举报

41

主题

301

帖子

265

银币

后起之秀

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

铜币
209
发表于 2022-7-6 14:51:49 | 显示全部楼层
buzzard先生
 
你为什么不使用单选按钮组?
因为它所需要的只是一个“ok”点上的cond&action互动程序?
 
  1. [color=#ff0000]: boxed_radio_column {             [/color]
  2. [color=red]label = "Choose a Whatever" ;[/color]
  3. [color=#ff0000]key = "Group_radio_1")[/color]
  4. [color=red]: radio_button {                 [/color]
  5. [color=red]              key = "W1";   [/color]
  6. [color=#ff0000]etc...[/color]
  7. (set_tile "[color=#ff0000]Group_radio_1" 0)[/color]
  8. [color=#ff0000](action_tile "ok" (setq hi (get_tile "Group_radio_1"))[/color]
  9. [color=#ff0000](cond [/color]
  10. [color=#ff0000]((= hi 0)[/color][color=#ff0000](setq hole "WB1")[/color][color=#ff0000])[/color]
  11. [color=#ff0000])[/color]

 
 
只是询问一下,因为你做dcl的时间比我长得多
回复

使用道具 举报

32

主题

1166

帖子

1146

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
159
发表于 2022-7-6 15:08:44 | 显示全部楼层
 
我学习的方式似乎适合我。
回复

使用道具 举报

41

主题

301

帖子

265

银币

后起之秀

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

铜币
209
发表于 2022-7-6 15:21:23 | 显示全部楼层
这是一个很好的理由
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 03:14 , Processed in 0.602010 second(s), 64 queries .

© 2020-2025 乐筑天下

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