I've tested LTK from http://www.peter-herth.de/ltk/ and it works with
Tcl/Tk from http://www.activestate.com/Products/ActiveTcl/ , but I would
like to have the NoteBook widget from the BWidgets demo. Is this a standard
Tcl/Tk control and how can I integrate it in LTK?
--
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Frank Buss wrote:
> I've tested LTK from http://www.peter-herth.de/ltk/ and it works with
> Tcl/Tk from http://www.activestate.com/Products/ActiveTcl/ , but I would
> like to have the NoteBook widget from the BWidgets demo. Is this a standard
> Tcl/Tk control and how can I integrate it in LTK?
>
Bwidgets is not one of the standard control -- it is one of the
semi-standard controls contained in TkLib (a close cousin of TclLib). Both
of which are distributed in the ActiveTcl product.
As to how to integrate it into LTK -- I have no earthly idea, you may want
to ask on a lisp newsgroup or ask the LTK author directly.
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester | "The man who fights for his ideals is |
| ·············@cox.net | the man who is alive." -- Cervantes |
+--------------------------------+---------------------------------------+
"Gerald W. Lester" <·············@cox.net> wrote:
> As to how to integrate it into LTK -- I have no earthly idea, you may
> want to ask on a lisp newsgroup or ask the LTK author directly.
I've created a first test version, see below. With this implementation
you can use it like this:
(defun test-note-book ()
(with-ltk
(let* ((nb (make-instance 'note-book))
(page1 (insert-page nb "end" :text "Page 1"))
(page2 (insert-page nb "end" :text "Page 2"))
(label1 (make-instance 'label :master page1 :text "Hello World!"))
(label2 (make-instance 'label :master page2 :text "This is the 2nd page")))
(pack nb)
(pack label1 :padx 20 :pady 20)
(pack label2)
(compute-size nb)
(raise-page page1))))
I've decided to use an extra class for the note-book-page, because
referencing it by name, like in the Tk interface, doesn't look like
the way the other widgets are used. Only the functions I need are
implemented, perhaps someone can complete it.
@Peter: You can integrate it in ltk.lisp, but perhaps a better idea would
be to write a Ltk extension for it.
BTW: I felt like doing macroexpand by hand while writing the
initialize-instance. Perhaps this can be simplified and used for all
other widgets, too.
(defclass note-book-page (widget)
((page-name :accessor page-name :initarg :page-name :initform nil)
(note-book :accessor note-book :initarg :note-book :initform nil)))
(defclass note-book (widget) ())
(defmethod initialize-instance :after ((nb note-book) &key font activebackground
activeforeground background borderwidth
disabledforeground foreground repeatdelay
repeatinterval arcradius height homogeneous
side tabbevelsize tabpady width)
(format-wish "package require BWidget")
(format-wish "NoteBook ~a ·@[ -font ~(~A~)~]~
·@[ -activebackground ~(~A~)~]·@[ -activeforeground ~(~A~)~]~
·@[ -background ~(~A~)~]·@[ -borderwidth ~(~A~)~]~
·@[ -disabledforeground ~(~A~)~]·@[ -foreground ~(~A~)~]~
·@[ -repeatdelay ~(~A~)~]·@[ -repeatinterval ~(~A~)~]~
·@[ -arcradius ~(~A~)~]·@[ -height ~(~A~)~]·@[ -homogeneous ~(~A~)~]~
·@[ -side ~(~A~)~]·@[ -tabbevelsize ~(~A~)~]·@[ -tabpady ~(~A~)~]~
·@[ -width ~(~A~)~]"
(widget-path nb) font activebackground activeforeground background
borderwidth disabledforeground foreground repeatdelay repeatinterval
arcradius height homogeneous side tabbevelsize tabpady width))
(defmethod insert-page ((nb note-book) index &key text)
(let ((page-name (create-name)))
(format-wish "senddata [~a insert ~a ~a ·@[ -text {~A}~]]"
(widget-path nb) index page-name text)
(let ((path (read-data)))
(if path
(make-instance 'note-book-page
:page-name page-name
:note-book nb
:path (string-downcase path))
(error "error while inserting page")))))
(defmethod raise-page ((nbp note-book-page))
(format-wish "~a raise ~a" (widget-path (note-book nbp)) (page-name nbp)))
(defmethod delete-page ((nbp note-book-page))
(format-wish "~a delete ~a" (widget-path (note-book nbp)) (page-name nbp)))
(defmethod compute-size ((nb note-book))
(format-wish "~a compute_size" (widget-path nb)))
--
Frank Bu�, ··@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Sorry for my slow answer, but I was cut of the net for some time an only
now catchung up again with things, only 1200 postings on c.l.l to read...
Thank you for the notebook wrapper, I have made a package of it, it
can be found at:
http://www.peter-herth.de/ltk/BWidget.lisp
and will include it in the next Ltk tarball. Speaking of it, yes I can
see how this kind of wrapper generation seems strange and I am currently
working on a solution of this. In the next release, all those
initialize-instance functions will be written by a set of macros, so you
only have to specify the list of initargs to create a new widget. From
the same list then the settable configuration methods could also be
automatically created.
Peter
--
pet project: http://dawn.netcologne.de
homepage: http://www.peter-herth.de
lisp stuff: http://www.peter-herth.de/lisp.html
get Ltk here: http://www.peter-herth.de/ltk/
"Frank Buss" <··@frank-buss.de> wrote
> I've tested LTK from http://www.peter-herth.de/ltk/ and it works
> with Tcl/Tk from http://www.activestate.com/Products/ActiveTcl/ ,
> but I would like to have the NoteBook widget from the BWidgets
> demo. Is this a standard Tcl/Tk control and how can I integrate it
> in LTK?
In principle, yes, you could use BLT's widgets. But LTK has a wrapper
around each widget. The docs say that it creates a LISP object as an
interface to the Tk widget. So if you want to use new widgets, you
would have to write code for more wrapper objects. You'd have to look
at the source code to see how hard that is. (I'm not a Lisp guy, so I
couldn't even begin to tell you.)
Bob
--
Bob Techentin ················@NOSPAMmayo.edu
Mayo Foundation (507) 538-5495
200 First St. SW FAX (507) 284-9171
Rochester MN, 55901 USA http://www.mayo.edu/sppdg/
According to Frank Buss <··@frank-buss.de>:
:I've tested LTK from http://www.peter-herth.de/ltk/ and it works with
:Tcl/Tk from http://www.activestate.com/Products/ActiveTcl/ , but I would
:like to have the NoteBook widget from the BWidgets demo. Is this a standard
:Tcl/Tk control and how can I integrate it in LTK?
If you are using ActiveTcl, then the NoteBook widget from BWidgets is
a part of your Tcl installation.
As for how to integrate it, perhaps
http://www.peter-herth.de/ltk/ltkdoc/node40.html
could be followed, only using BWidgets instead of Tix?
--
<URL: http://wiki.tcl.tk/ > MP3 ID tag repair < http://www.fixtunes.com/?C=17038 >
Even if explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.
<URL: ··············@gmail.com > <URL: http://www.purl.org/NET/lvirden/ >
Frank Buss wrote:
> I've tested LTK from http://www.peter-herth.de/ltk/ and it works with
> Tcl/Tk from http://www.activestate.com/Products/ActiveTcl/ , but I would
> like to have the NoteBook widget from the BWidgets demo. Is this a standard
> Tcl/Tk control and how can I integrate it in LTK?
If LTK is tied in through Tcl to Tk (as it appears), then you
should have access to pretty much any widget that Tk offers.
You will have to add it in through whatever low-level API LTK
offers to pass Tcl commands. The necessary commands are:
package require BWidget
NoteBook .nb ...
--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos
Frank Buss wrote:
> I've tested LTK from http://www.peter-herth.de/ltk/ and it works with
> Tcl/Tk from http://www.activestate.com/Products/ActiveTcl/ , but I would
> like to have the NoteBook widget from the BWidgets demo. Is this a standard
> Tcl/Tk control and how can I integrate it in LTK?
If LTK is tied in through Tcl to Tk (as it appears), then you
should have access to pretty much any widget that Tk offers.
You will have to add it in through whatever low-level API LTK
offers to pass Tcl commands. The necessary commands are:
package require BWidget
NoteBook .nb ...
--
Jeff Hobbs, The Tcl Guy
http://www.ActiveState.com/, a division of Sophos