I've just started playing with ltk -- it's nice!
I have two questions. One -- it seems that support for text widget commands is very limited. Will anyone be working on that? (as an example, there is no "tag add", "tag delete", "tag remove", "tag lower", etc.).
Two -- is tk8.5 support planned? I'm afraid I'll have to use 8.5 because of a much better text widget (cursor keys finally work as expected). I tried just running things with wish8.5, but there are errors.
--J.
Hello Jan,
I have two questions. One -- it seems that support for text widget commands is very limited. Will anyone be working on that? (as an example, there is no "tag add", "tag delete", "tag remove", "tag lower", etc.).
In general I consider Ltk as supporting all Tk features - so if something escaped me, it is because I overlooked it and never tried to use it. So pointing out those points certainly helps in getting them added :).
Two -- is tk8.5 support planned? I'm afraid I'll have to use 8.5 because of a much better text widget (cursor keys finally work as expected). I tried just running things with wish8.5, but there are errors.
Sure, I am also looking forward to all improvements to the Tk engine, so I definitely plan to stay along with the progress. Ltk *should* run in 8.5 out of the box (as far as I expect Tk 8.5 to be backwards compatible), but again, if you encounter errors, please post them so I can have a look into fixing them.
Peter
"Peter" == Peter Herth herth@peter-herth.de writes:
Peter> Hello Jan,
I have two questions. One -- it seems that support for text widget commands is very limited. Will anyone be working on that? (as an example, there is no "tag add", "tag delete", "tag remove", "tag lower", etc.).
Peter> In general I consider Ltk as supporting all Tk features - so if Peter> something escaped me, it is because I overlooked it and never Peter> tried to use it. So pointing out those points certainly helps in Peter> getting them added :).
Ok -- what I need is basically the full functionality of the text widget, including tag, mark and (later) image support. For the moment the most important thing is the range of tag commands:
pathName tag option ?arg arg ...?
pathName tag add tagName index1 ?index2 index1 index2 ...? pathName tag bind tagName ?sequence? ?script? pathName tag cget tagName option pathName tag configure tagName ?option? ?value? ?option value ...? pathName tag delete tagName ?tagName ...? pathName tag lower tagName ?belowThis? pathName tag names ?index? pathName tag nextrange tagName index1 ?index2? pathName tag prevrange tagName index1 ?index2? pathName tag raise tagName ?aboveThis? pathName tag ranges tagName pathName tag remove tagName index1 ?index2 index1 index2 ...
I think only bind and configure are implemented at this time.
Later on, I'll need most of the other text widget commands as listed at http://www.tcl.tk/man/tcl8.5/TkCmd/text.htm
Two -- is tk8.5 support planned? I'm afraid I'll have to use 8.5 because of a much better text widget (cursor keys finally work as expected). I tried just running things with wish8.5, but there are errors.
Peter> Sure, I am also looking forward to all improvements to the Tk Peter> engine, so I definitely plan to stay along with the Peter> progress. Ltk *should* run in 8.5 out of the box (as far as I Peter> expect Tk 8.5 to be backwards compatible), but again, if you Peter> encounter errors, please post them so I can have a look into Peter> fixing them.
Encouragement helps -- I double checked and the errors I was getting were the result of trying to use ltk-tile with tk8.5a4. After I removed tile, things seem to work fine!
thanks, --J.
Ok -- what I need is basically the full functionality of the text widget, including tag, mark and (later) image support. For the moment the most important thing is the range of tag commands:
pathName tag option ?arg arg ...?
pathName tag add tagName index1 ?index2 index1 index2 ...? pathName tag bind tagName ?sequence? ?script? pathName tag cget tagName option pathName tag configure tagName ?option? ?value? ?option value ...? pathName tag delete tagName ?tagName ...? pathName tag lower tagName ?belowThis? pathName tag names ?index? pathName tag nextrange tagName index1 ?index2? pathName tag prevrange tagName index1 ?index2? pathName tag raise tagName ?aboveThis? pathName tag ranges tagName pathName tag remove tagName index1 ?index2 index1 index2 ...
Ok, I put them on my list.
I think only bind and configure are implemented at this time.
Later on, I'll need most of the other text widget commands as listed at http://www.tcl.tk/man/tcl8.5/TkCmd/text.htm
I do not plan to add specific 8.5 features until it seems to be finalized and unfortunately that seems to be still a bit away, however...
Encouragement helps -- I double checked and the errors I was getting were the result of trying to use ltk-tile with tk8.5a4. After I removed tile, things seem to work fine!
... if there area errors, please report them and I might try to fix them. Tile is probably the most obvious missing feature of current 8.5 releases, but I get the impression there are plans to have tile in the final release.
Peter
Well. So I went ahead and implemented all the tag commands except for cget and ranges, fixing a minor thing in the process:
(defun tag-to-string (tag) "Convert a lisp-side tag to a string, return the resulting string" (if (stringp tag) tag (if tag (format nil "~(~a~)" tag) "")))
(defgeneric tag-add (txt tag &rest indices)) (defmethod tag-add ((txt text) tag &rest indices) (format-wish "~a tag add ~a ~{ ~(~a~)~}" (widget-path txt) (tag-to-string tag) indices) txt)
(defgeneric tag-remove (txt tag &rest indices)) (defmethod tag-remove ((txt text) tag &rest indices) (format-wish "~a tag remove ~a ~{ ~(~a~)~}" (widget-path txt) (tag-to-string tag) indices) txt)
(defgeneric tag-configure (txt tag option value)) (defmethod tag-configure ((txt text) tag option value) (format-wish "~a tag configure ~a -~(~a~) {~(~a~)}" (widget-path txt) (tag-to-string tag) option value) txt)
(defgeneric tag-bind (txt tag event fun)) (defmethod tag-bind ((txt text) tag event fun) "bind fun to event of the tag of the text widget txt" (let ((name (create-name))) (add-callback name fun) (format-wish "~a tag bind ~(~a~) ~a {callback ~A}" (widget-path txt) (tag-to-string tag) event name)) txt)
(defgeneric tag-delete (txt tag &rest other-tags)) (defmethod tag-delete ((txt text) tag &rest other-tags) (format-wish "~a tag delete ~a ~{ ~(~a~)~}" (widget-path txt) (tag-to-string tag) (mapcar #'tag-to-string other-tags)) txt)
(defgeneric tag-lower (txt tag &optional other-tag)) (defmethod tag-lower ((txt text) tag &optional other-tag) (format-wish "~a tag lower ~a ~a" (widget-path txt) (tag-to-string tag) (tag-to-string other-tag)) txt)
(defgeneric tag-raise (txt tag &optional other-tag)) (defmethod tag-raise ((txt text) tag &optional other-tag) (format-wish "~a tag raise ~a ~a" (widget-path txt) (tag-to-string tag) (tag-to-string other-tag)) txt)
(defgeneric tag-names (txt index)) (defmethod tag-names ((txt text) index) (format-wish "~a tag names ~(~a~)" (widget-path txt) index) txt)
(defgeneric tag-nextrange (txt tag index1 &optional index2)) (defmethod tag-nextrange ((txt text) tag index1 &optional index2) (format-wish "~a tag nextrange ~a ~(~a~) ~(~a~)" (widget-path txt) (tag-to-string tag) index1 (if index2 index2 "")) txt)
(defgeneric tag-prevrange (txt tag index1 &optional index2)) (defmethod tag-prevrange ((txt text) tag index1 &optional index2) (format-wish "~a tag nextrange ~a ~(~a~) ~(~a~)" (widget-path txt) (tag-to-string tag) index1 (if index2 index2 "")) txt)
(defgeneric tag-ranges (txt tag)) (defmethod tag-ranges ((txt text) tag) (format-wish "~a tag ranges ~a" (widget-path txt) (tag-to-string tag)) (read-data))
Now, both cget and ranges need to read data from wish -- how do I do that? It seems that read-data will break if there is no data to read, and "tag ranges" may or may not return data.
--J.