弹出菜单(取消菜单)
你好我有一个lisp来写多行文字,但在它执行之前,用户可以用弹出的弹出菜单从不同的比例中选择。
用户也可以选择另一个,可以是一个数字,可能像123348等。。。等
我错过的是,我不能确切地做到这是进入这个弹出菜单文本“取消”,如果用户选择它,它取消了命令,然后再继续制作多行文字。
这是我弹出窗口的来源。lsp I中没有“取消”。。我只是写了这个例子。
你需要DOSlib
或者当点击ESC时,它就会消失。。。我现在做不到。我必须选择比例
(Defun PopupScale ()
(setq x (list "Choose scale:" """1:1" "1:2"
"1:5" "1:10" "1:20""1:50" "1:100"
"1:200" "1:500" """Another...""Cancel"
)
ChoosedScale nil
scale nil
controlscale
nil
)
(while (or (not ChoosedScale) (= ChoosedScale 0))
(setq ChoosedScale (dos_popupmenu x))
)
(IF (= ChoosedScale (- (length x) 3))
(while (not scale)
(setq scale (dos_getstring "Choose another:" "Write a custom scale:"))
(IF (wcmatch scale "*=*,*:*")
(setq scale (substr scale 3))
)
(setq controlscale (wcmatch scale "*@*"))
(IF controlscale
(Alert "You have typed a wrong number. \nCould be a letter"
)
)
)
(IF (not (= ChoosedScale (- (length x) 4))) ; last scale
(setq scale (substr (nth (1+ ChoosedScale) x) 3))
(setq scale (substr (nth (- (length x) 3) x)
3
)
)
)
)
) 它的dos_弹出菜单。。。
隐马尔可夫模型。。这可能是不可能的。。。。在DOSLib帮助中找不到任何内容。
没有什么是不可能的。这与doslib函数无关,如果没有填充所有必需的变量,您只需停止程序继续。
您还应该使用cond代替几个if语句。这是你吃的东西的一个修改版本,我把骨架放在一起,只加了肉和土豆。哦,与其通过零化变量来开始一个例程,不如从……开始本地化它们。。。。
(defun PopupMenu (/ scalelist ChosenScale scale)
(setq scalelist (list "Choose scale:" "" "1:1"
"1:2" "1:5" "1:10" "1:20"
"1:50" "1:100" "1:200" "1:500"
"" "Another..." "Cancel"
) ;_ list
) ;_ setq
(while
(or (not ChosenScale)
(= 0 ChosenScale)
) ;_ or
(setq ChosenScale (dos_popupmenu scalelist))
) ;_ while
(cond
((>= 9 ChosenScale)
;; a scale from list chosen
(princ (strcat "\nYou chose: " (rtos ChosenScale)))
;; Do stuff here
)
;; "Another..." chosen
((= 10 ChosenScale)
;; Do stuff here
(princ (strcat "\nYou chose: " (rtos ChosenScale)))
)
) ;_ cond
(if scale
;; Proceed with routine
(princ "\nLet us do more!")
(princ "\nUser Quit")
) ;_ if
(princ)
) ;_ defun
页:
[1]