- UID
- 4198
- 积分
- 621
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-4-22
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
[求助][0614]关于"计算机"程序输入疑问?
请问在这计算机程序中,
该怎样让此计算机的输入,
可以支援键盘上的"num lock"数字区的输入呢?
烦请各位高手可以帮忙解答一下
谢谢~
DCL FILE:
[PHP]
exp6:dialog{
label="数字计算机";
:column{
:concatenation{
:edit_box{
label="手动区";key="disp_user";edit_width=20;
}
:button{label="↓计算↓";key="bans";width=2;}
}
:edit_box{label="计算区";key="disp";edit_with=30;}
spacer_1;
// 第一列 共有五个框钮,分别为 ‘7’、8’、‘9’、‘%’ 、‘CE’
:row{
:button{label="7";key="key7";}
:button{label="8";key="key8";}
:button{label="9";key="key9";}
:button{label="%";key="keyp";}
:button{label="CE";key="keyce";}
}
// 第二列 共有五个框钮,分别为 ‘4’、‘5’、‘6’、‘X’ 、‘/’
:row{
:button{label="4";key="key4";}
:button{label="5";key="key5";}
:button{label="6";key="key6";}
:button{label="X";key="keys1";}
:button{label="/";key="keys2";}
}
// 第三列 共有五个框钮,分别为 ‘1’、‘2’、‘3’、‘+’ 、‘-’
:row{ // 第三列
:button{label="1";key="key1";}
:button{label="2";key="key2";}
:button{label="3";key="key3";}
:button{label="+";key="keys3";}
:button{label="-";key="keys4";}
}
// 第四列 共有三个框钮,分别为 ‘0’、‘.’ 、‘=’
:row{ // 第四列
:button{label="0";key="key0";}
:button{label=".";key="keys5";}
:button{label="=";key="keys6";}
}
}
spacer_1;
ok_only;
}
[/PHP]
LSP FILE:
[PHP]
(if (null cal)(arxload"geomcal"))
(defun c:exp6()
(setvar "cmdecho" 0)
(setq dcl_id (load_dialog "exp6.dcl"))
(dcl_exp6)
)
(defun dcl_exp6()
(new_dialog "exp6" dcl_id)
(set_tile "disp" "0")
(setq lastinput "num" num1 "")
(action_tile "key1" "(disp_nn \"1\")")
(action_tile "key2" "(disp_nn \"2\")")
(action_tile "key3" "(disp_nn \"3\")")
(action_tile "key4" "(disp_nn \"4\")")
(action_tile "key5" "(disp_nn \"5\")")
(action_tile "key6" "(disp_nn \"6\")")
(action_tile "key7" "(disp_nn \"7\")")
(action_tile "key8" "(disp_nn \"8\")")
(action_tile "key9" "(disp_nn \"9\")")
(action_tile "key0" "(disp_nn \"0\")")
(action_tile "keys1" "(keys1_n)")
(action_tile "keys2" "(keys2_n)")
(action_tile "keys3" "(keys3_n)")
(action_tile "keys4" "(keys4_n)")
(action_tile "keys5" "(keys5_n)")
(action_tile "keys6" "(keys6_n)")
(action_tile "keyp" "(keyp_n)")
(action_tile "keyce" "(keyce_n)")
(action_tile "bans" "(sub_bans)")
(action_tile "accept" "(cal_ok)(done_dialog 1)")
(setq dd1 (start_dialog))
ans
)
(defun sub_bans()
(setq disp_val 0)
(setq calstr (get_tile "disp_user"))
(if (/= calstr "")
(progn
(setq disp_val (cal calstr))
(set_tile "disp" (rtos disp_val 2 4))
)
(alert "手动区,无计算式!")
)
)
(defun cal_ok()
(setq ans (atof (get_tile "disp")))
)
(defun disp_nn(nn)
(setq nn1 (get_tile "disp"))
(if (/= nn1 "0")
(if (= lastinput "num") (setq nn (strcat nn1 nn)))
)
(set_tile "disp" nn)
(setq lastinput "num")
)
(defun keyce_n()
(set_tile "disp" "0")
(setq num1 "" lastinput "num")
)
(defun keyp_n()
(setq num1 (get_tile "disp"))
(setq num1 (atof num1))
(setq num1 (rtos (/ num1 100) 2))
(set_tile "disp" num1)
(setq lastinput "opt")
)
(defun keys1_n()
(if (= num1 "")
(setq num1 (get_tile "disp"))
(keys6_n)
)
(setq lastinput "opt")
(setq opt "*")
)
(defun keys2_n()
(if (= num1 "")
(setq num1 (get_tile "disp"))
(keys6_n)
)
(setq lastinput "opt")
(setq opt "/")
)
(defun keys3_n()
(if (= num1 "")
(setq num1 (get_tile "disp"))
(keys6_n)
)
(setq opt "+")
(setq lastinput "opt")
)
(defun keys4_n()
(setq nnK (get_tile "disp"))
(if (= num1 "")
(cond ((= nnK "0")
(progn
(set_tile "disp" "-")
(setq lastinput "num")
))
((= nnK "")
(progn
(set_tile "disp" "-")
(setq lastinput "num")
))
(t (setq num1 (get_tile "disp") opt "-" lastinput "opt"))
)
(cond ((= lastinput "opt")
(progn
(set_tile "disp" "-")
(setq lastinput "num")
))
(t (progn (keys6_n) (setq lastinput "opt" opt "-")))
)
)
)
(defun keys5_n()
(setq nn (get_tile "disp"))
(if (= lastinput "num")
(cond ((= nn "0") (set_tile "disp" "0."))
((= nn "") (set_tile "disp" "0."))
(t (set_tile "disp" (strcat nn ".")))
)
(set_tile "disp" "0.")
)
(setq lastinput "num")
)
(defun keys6_n()
(setq num2 (get_tile "disp"))
(cond ((= opt "*") (setq ans (* (atof num1) (atof num2))))
((= opt "/")
(if (= (atof num2) 0)
(progn
(alert "Error !! Division by 0.")
(setq ans (atof num1))
)
(setq ans (/ (atof num1) (atof num2)))
))
((= opt "-") (setq ans (- (atof num1) (atof num2))))
((= opt "+") (setq ans (+ (atof num1) (atof num2))))
)
(setq num1 (rtos ans 2))
(set_tile "disp" num1)
(setq lastinput "num" num2 "" opt "")
)
(prin1)
[/PHP] |
|