Small Fish 发表于 2022-7-6 09:33:58

灰显弹出列表

嗨,我有一个对话框,有2个单选按钮和3个弹出列表
 
我在灰显弹出列表时遇到问题。
 
当选择一个单选按钮(横向坡度)时,我希望“横向坡度”弹出列表清晰,其他两个按钮,即“左外倾角%和右外倾角%变灰”。
 
当选择“外倾角”单选按钮时,“外倾角%左”和“外倾角%右”弹出列表清晰,“横向坡度”变灰。
 
任何人都有一个解决方案,而不改变我的dcl功能太多-因为我或多或少了解它。
非常感谢
 
(defun c:greytest (/)
(setq ONOFF "0")
(greytestdcl)
)
      
(defun greytestdcl (/ReturnValueGradTypeTile)
(defun CheckOnClose (/ )

(cond
((not(setq GradTypeTile (get_tile "GradType")))
(mode_tile "GradType" 2)
)
(T
(setq
    XFallLhs   (nth (read (get_tile "XFallLhs"))XFallLhsList)
    XFallRhs   (nth (read (get_tile "XFallRhs"))XFallRhsList)
    XFall      (nth (read (get_tile "XFall"      ))XFallList)
);setq
(done_dialog 1)
);T
);cond
);defun CheckOnClose

(if (> (setq DLGID (load_dialog "greytest.dcl")) 0)
(progn
(new_dialog "greytest" DLGID)

(setq XFallLhsList '( "0.5" "1.0" "1.5" "2.0" "2.5" "3.0" "3.5" "4.0" ))
(start_list "XFallLhs")
(mapcar 'add_list   XFallLhsList)
(end_list)
(if (member XFallLhs XFallLhsList)
(set_tile "XFallLhs" (rtos (vl-position XFallLhs XFallLhsList) 2 0))
(set_tile "XFallLhs" "3")
);if

(setq XFallRhsList '( "0.5" "1.0" "1.5" "2.0" "2.5" "3.0" "3.5" "4.0" ))
(start_list "XFallRhs")
(mapcar 'add_list   XFallrhsList)
(end_list)
(if (member XFallRhs XFallRhsList)
(set_tile "XFallRhs" (rtos (vl-position XFallRhs XFallRhsList) 2 0))
(set_tile "XFallRhs" "3")
);if

(setq XFallList '( "0.5" "1.0" "1.5" "2.0" "2.5" "3.0" "3.5" "4.0" ))
(start_list "XFall")
(mapcar 'add_list   XFallList)
(end_list)
(if (member XFall XFallList)
(set_tile "XFall" (rtos (vl-position XFall XFallList) 2 0))
(set_tile "XFall" "3")
);if

(action_tile "XFallLhs" "(ErrorDLG 0)")
(action_tile "XFallRhs" "(ErrorDLG 0)")
(action_tile "XFall" "(ErrorDLG 0)")

(action_tile "onoff" "(setq onoff $value)(onf)")

(action_tile "accept" "(CheckOnClose)")
(action_tile "cancel" "(exit)")

(if (= ONOFF "1")
(set_tile "onoff" "1")
);if
(ONF)

(setq ReturnValue(start_dialog))
(unload_dialog DLGID)
);progn
(not (princ "\nNo DCL"))
);if
ReturnValue
);defun

(defun ONF ()
(if (= ONOFF "1")
(progn
(mode_tile "XFall" 0)
);progn
(progn
(mode_tile "XFall" 1)
);progn
);if
);defun

(defun ErrorDLG (pErr)
(cond
((= pErr 0) (set_tile "error" ""))
);cond
);defun



dcl_settings : default_dcl_settings { audit_level = 3 ; }
greytest : dialog {
label = "Grey test" ;
spacer_1;
:boxed_radio_column{
fixed_width = true ;
label ="Road Gradient Type";
key = "GradType";
:radio_button {
label ="Cross Fall                                                                " ;
key = "CrossFall" ;
}
:radio_button {
label ="Camber";
key = "Camber" ;
}
}//End radio row

:boxed_column {
   width = 1 ;
:popup_list {
label = "Camber % Left                                             ";
key = "XFallLhs" ;
}//popup list

width = 1 ;
:popup_list {
label = "Camber % Right                                          ";
key = "XFallRhs" ;
}//popup list

width = 1 ;
:popup_list {
label = "Crossfall %                                                ";
key = "XFall" ;
}//popup list

width = 1 ;
spacer_1 ;
    }//boxed column


errtile ;
ok_cancel ;
}//dialog

pBe 发表于 2022-7-6 09:43:12

(defun c:greytest (/)
(setq ONOFF "0")
(greytestdcl)
)

(defun greytestdcl (/ReturnValueGradTypeTile)
(defun CheckOnClose (/ )

(cond
((not(setq GradTypeTile (get_tile "GradType")))
(mode_tile "GradType" 2)
)
(T
(setq
    XFallLhs   (nth (read (get_tile "XFallLhs"))XFallLhsList)
    XFallRhs   (nth (read (get_tile "XFallRhs"))XFallRhsList)
    XFall      (nth (read (get_tile "XFall"      ))XFallList)
);setq
(done_dialog 1)
);T
);cond
);defun CheckOnClose
(if (> (setq DLGID (load_dialog "greytest.dcl")) 0)
(progn
(new_dialog "greytest" DLGID)
(setq XFallLhsList '( "0.5" "1.0" "1.5" "2.0" "2.5" "3.0" "3.5" "4.0" ))
(start_list "XFallLhs")
(mapcar 'add_list   XFallLhsList)
(end_list)
(if (member XFallLhs XFallLhsList)
(set_tile "XFallLhs" (rtos (vl-position XFallLhs XFallLhsList) 2 0))
(set_tile "XFallLhs" "3")
);if
(setq XFallRhsList '( "0.5" "1.0" "1.5" "2.0" "2.5" "3.0" "3.5" "4.0" ))
(start_list "XFallRhs")
(mapcar 'add_list   XFallrhsList)
(end_list)
(if (member XFallRhs XFallRhsList)
(set_tile "XFallRhs" (rtos (vl-position XFallRhs XFallRhsList) 2 0))
(set_tile "XFallRhs" "3")
);if
(setq XFallList '( "0.5" "1.0" "1.5" "2.0" "2.5" "3.0" "3.5" "4.0" ))
(start_list "XFall")
(mapcar 'add_list   XFallList)
(end_list)
(if (member XFall XFallList)
(set_tile "XFall" (rtos (vl-position XFall XFallList) 2 0))
(set_tile "XFall" "3")
);if
(mode_tile "XFallLhs" 1)
(mode_tile "XFallRhs" 1)
(mode_tile "XFall" 1)
(action_tile "CrossFall" "(Modetest)")
(action_tile "Camber""(Modetest)")
(action_tile "XFallLhs" "(ErrorDLG 0)")
(action_tile "XFallRhs" "(ErrorDLG 0)")
(action_tile "XFall" "(ErrorDLG 0)")

(action_tile "onoff" "(setq onoff $value)(onf)")
(action_tile "accept" "(CheckOnClose)")
(action_tile "cancel" "(exit)")
(if (= ONOFF "1")
(set_tile "onoff" "1")
);if
(ONF)

(setq ReturnValue(start_dialog))
(unload_dialog DLGID)
);progn
(not (princ "\nNo DCL"))
);if
ReturnValue
);defun
(defun ONF ()
(if (= ONOFF "1")
(progn
(mode_tile "XFall" 0)
);progn
(progn
(mode_tile "XFall" 1)
);progn
);if
);defun
(defun ErrorDLG (pErr)
(cond
((= pErr 0) (set_tile "error" ""))
);cond
);defun

(defun ModeTest ()
(if (eq(get_tile "CrossFall") "1")
    (progn (mode_tile "XFallLhs" 1)
            (mode_tile "XFallRhs" 1)
      (mode_tile "XFall" 0))
    (progn (mode_tile "XFallLhs" 0)
            (mode_tile "XFallRhs" 0)
      (mode_tile "XFall" 1))
   )
)
 
单选按钮的操作

Small Fish 发表于 2022-7-6 09:55:58

嘿,PBe-太棒了!!!-我的尝试没有那么接近。非常感谢。
 
只有一个小问题-我知道如何让弹出列表和编辑框中的值记住
它们在会话中的价值,但如何使单选按钮记住其“位置”?(即其最后设置)
我的总是返回默认单选按钮

Lee Mac 发表于 2022-7-6 10:00:10

(set_tile"1")

Guest kruuger 发表于 2022-7-6 10:10:40

http://web2.airmail.net/terrycad/Tutorials/MyDialogs.htm#MyRadios
克鲁格

Lee Mac 发表于 2022-7-6 10:17:19

 
可能需要一些时间来研究以下代码:
(defunc:测试(/*错误*文件手);;-------------------------------------------------------;;;;示例演示如何回忆以前的内容;;;;所选单选按钮;;;;;;©Lee Mac 2011-www.Lee-Mac。通用域名格式;;;;-----------------------------------------------------------------;;(defun*错误*(msg)(if(和手部(

Guest kruuger 发表于 2022-7-6 10:20:53

李:你应该在什么地方出版你的样本/测试例程书?我想买一个
保存单选按钮设置,对话框位置,动态创建dcl-太好了。
 
克鲁格

Lee Mac 发表于 2022-7-6 10:31:07

谢谢Kruuger
 
我不确定我是否有时间(或足够的知识)出版整本书。。。但我很高兴你能发现我的例子很有帮助。我可能会在某个时候将其添加到我的网站,以便于访问。
 
谢谢
 

Small Fish 发表于 2022-7-6 10:40:13

谢谢Kruuger和Lee mac帮助我
旧金山
页: [1]
查看完整版本: 灰显弹出列表