Discussion:
menu of ltk
Kamuy Cikap
7 years ago
Permalink
Hi everyone.

I have a question.

There is check button and radio button in Tcl/Tk8.4 in menu.
is there check button and radio button in menu widget of LTK?

I looked ltktest in ltk.lisp source code.
I found make - menu and "make-menubutton".
Furthermore I found "add-separator".

Is there a check button or radio button in the same way?

Please Tell me this code.
cage
7 years ago
Permalink
Post by Kamuy Cikap
Hi everyone.
Hello!
Post by Kamuy Cikap
I have a question.
There is check button and radio button in Tcl/Tk8.4 in menu.
is there check button and radio button in menu widget of LTK?
[...]

Ltk exports :menucheckbutton and :menuradiobutton. Maybe this is what
you are looking for.

Bye!
C.
Kamuy Cikap
7 years ago
Permalink
Hi.
cage and everyone.
Thanks a lot to your e-mail.

but....

I found menucheckbutton in ltk.lisp.
It was on line 2020 in ltk.lisp.

I do not found how to write code "menucheckbutton".

Please tell me code of lisp.
this is a my sample code.

----------------
;;; LTK Menu Test

(ql:quickload :ltk)


;; Make Package
(defpackage :ex4-18
(:use :common-lisp
:common-lisp-user
:ltk)
(:export :main))

(in-package :ex4-18)

(defun main ()
(with-ltk ()
(wm-title *tk* "Menu sample")
(minsize *tk* 600 500)

(let* (
;; Make menu bar
(mb (make-menubar))

;;Menu Type
(mshurui (make-menu mb "Type" ))

(mf-command (make-menubutton mshurui "Command"
(lambda () ;(error "asdf")
(format t "Command pressed~&")
(finish-output))
:underline 1))

;; This is the My Point1. I want to make checkbutton. but now
menubutton.
(mf-checkbtn (make-menubutton mshurui "Checkbutton"
(lambda () ;(error "asdf")
(format t "Checkbutton pressed~&")
(finish-output))
:underline 1))


(sep1 (add-separator mshurui))

;; This is the My Point2. I want to make radiobutton. but now
menubutton.
(mf-radiobtn1 (make-menubutton mshurui "RadioButton1"
(lambda () ;(error "asdf")
(format t "RadioButton1
pressed~&")
(finish-output))
:underline 1))

(mf-radiobtn2 (make-menubutton mshurui "RadioButton2"
(lambda () ;(error "asdf")
(format t "RadioButton2
pressed~&")
(finish-output))
:underline 1))

(mf-radiobtn3 (make-menubutton mshurui "RadioButton3"
(lambda () ;(error "asdf")
(format t "RadioButton3
pressed~&")
(finish-output))
:underline 1))

(sep2 (add-separator mshurui))

(mf-export (make-menu mshurui "Cascade"))

(mfe-jpg (make-menubutton mf-export "Cmd1" (lambda ()
(format t
"cmd1 pressed~&")

(finish-output))))
(mfe-gif (make-menubutton mf-export "Cmd2" (lambda ()
(format t
"cmd2 pressed~&")

(finish-output))))

(sep3 (add-separator mshurui))


(mf-close (make-menubutton mshurui "Close"
(lambda () ;(error "asdf")
(format t "Close pressed~&")
(setf *exit-mainloop* t)
(finish-output))
:underline 1))

(msg (make-instance 'message
:text "This is the Ltk MenuBar test."
:width 1000
:background "#FFFFFF"))

(b1 (make-instance
'button
:text "Close"
:command (lambda ()
(format t "Close")
(setf *exit-mainloop* t)))))

(pack msg
:side :top
:fill :x) ;

(pack b1
:side :bottom
:fill :x)

)))

(main)
Post by cage
Post by Kamuy Cikap
Hi everyone.
Hello!
Post by Kamuy Cikap
I have a question.
There is check button and radio button in Tcl/Tk8.4 in menu.
is there check button and radio button in menu widget of LTK?
[...]
Ltk exports :menucheckbutton and :menuradiobutton. Maybe this is what
you are looking for.
Bye!
C.
Volker Sarodnick
7 years ago
Permalink
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>
<div>Hi Kamuy,</div>

<div>&nbsp;</div>

<div>maybe something like that:</div>

<div>&nbsp;</div>

<div>(mf-chk (make-instance &#39;menucheckbutton :master mfile<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :text &quot;Menucheckbutton&quot;))</div>

<div>&nbsp;</div>

<div>and you could get the value of the checkbutton by using:</div>

<div>&nbsp;</div>

<div>(value mf-chk)</div>

<div><br/>
Regards<br/>
Volker</div>

<div>&nbsp;</div>
</div>
</div></div></body></html>

Loading...