How can I set the maximum window size of a LTK window?
(ql:quickload "ltk")
(defpackage :pub-quiz
(:use :ltk :cl))
(in-package :pub-quiz)
(defun pub-quiz-window ()
(with-ltk ()
(let* ((f (make-instance 'frame :relief :groove :height 500 :width 300))
(pub (make-instance 'label :master f :text "Pub Quiz"))
(outtext (make-instance 'text :font "monospaced" :wrap :word))
(tf (make-instance 'text :font "monospaced")))
(pack f)
(pack pub :side :left)
(pack outtext :ipady 100)
(pack tf))))
If I set the frame size to height and width like in the above code sample, my window wm does not respect these values at all.
The Tk docs have this
wm maxsize .window 500 500
but I don't know how to translate this into something LTK understands.
I haven't used LTK, so I can't make much claim about how this is supposed to be done; I'm just answering based on what I've found online. The LTK manual mentions in section 3.7 that there is a
maxsizefunction:Calling
(maxsize f 500 500)doesn't work though. The implementation ofmaxsizeis:The number translation works just fine, I think
(ltk::tk-number 500) => 500. However,(widget-path f), for thefin your code returns.wc, not.window, as the TK snippet you posted shows. You could run that code directly withbut that causes an error too:
I'm not sure what element's path will work for you in this case, but it seems like once you've found that,
maxsizewill do what you need it to. There is atoplevelclass, and callingmaxsizewith instances of it seems to work, so perhaps you should explorePlaying around with it, I can sort of get that to work, although that "Pub Quiz" label seems to keep appearing as a separate window…