Hello All,
I've been playing with toxy today (in particular the nifty examples in CVS)
Thanks for all the work going into this, its a very cool project.
Oh the reason why I'm playing with it two things, I'd like to be able to use a nice "popup" menu to select from a number of things in a list, but the list is only visible when interacting. (takes up very little screen space). I'm also after a multi-line text entry widget.
I have a working popup menu, and it works as a GOP, but its GOP bounds get all screwed up in 37-0 (when you move the object it shrink-wraps around the widget, if you save and load it you get a GOP box that does not fit with the proportions of the widget (tall and thin) but it works.
I'm having some troubles with text entry though. I've hacked the example using an entry widget and replaced it with a text widget, which works great, except for a couple issues, multiple spaces and carrige returns are not preserved, and the result is wrapped in {} braces. I'd like to use this with the gem text objects, so it would be nice to be able to put line-breaks (say does text in gem even support line breaks?) but I'd be happy with spaces. So how do I remove the curly braces from inside the default.wip?
I also have one general question, why are native PD wigets used in PD outside of property boxes? I would imagine a tk scroolbar would be a lot more efficient than a vector drawing of one.. I think more tk widgets (or whatever toolkit) should be available as interfaces inside PD. Toxy is being a little taxing, anyone working on a pop-up menu or text-entry external? The other thing was a "playlist" style file reader, but using a tk listbox and scrollbar...
Thanks again, (especially to Kristof!)
any comments appreciated.
Thanks Ben
PS: What exactly does: eval .<[.- get ].> do? I'm trying to add a string range command to strip the curly braces, but I don't know where to put it! "string range $string 1 [expr [string length $string] -2]"
hi Ben,
toxy widget stuff ``proves the concept'' more than does anything else, currently (although I do use it in my work). Or... even worse -- what is it going to prove most likely, unless a set of well-integrated widget types is defined, is the common wisdom of tcl/tk being a nostalgic toy for old-style hackers... Now, about the text widget --
B. Bogart wrote: ...
I'm having some troubles with text entry though. I've hacked the example using an entry widget and replaced it with a text widget, which works great, except for a couple issues, multiple spaces and carrige returns are not preserved, and the result is wrapped in {} braces. I'd like to use this with
...
PS: What exactly does: eval .<[.- get ].> do? I'm trying to add a string
it evaluates the contents of .<.> brackets, and sends the result to the pd side. That result is parsed into atoms, and comes out of the left outlet of a widget, or any of its tows.
Actually, ".<xxx.>" should be equivalent to "pd .| _cb xxx .`.:", but in case of a multi-word result it is not, due to an extra level of grouping, which is a bug.
(The sequence .| above is resolved to the pd target bound to the widget object, and its tows).
Since .- is resolved as the widget's pathname, the contents in the entry widget example (.- get) specifies the Tk command "pathName get", without arguments. Which works for the entry, but a text widget needs explicit indices (e.g. ".- get 1.0 end" for the entire text, or even ".- get 0.end end", to prevent pd from parsing 1.0 as the number 1).
One way of dealing with line breaks could be defining a @float handler and getting each line separately by sending a float to the widget or its tow. The "string map" command may be used to glue the space chars, preventing pd from parsing them as atom separators. Thus this line
@float pd .| _cb [string map .(" " ".`.` ".) [.- get .#1.0 .#1.end]] .`.:
would be the simplest definition of a handler, to be put in a .wid file, or triggered by a loadbang.
In order to get the current number of lines, through [r nlines], the widget object (or, better, its tow), should be sent:
tot pd nlines [expr [.- index end] - 1] .`.:
Obviously, text widget does not integrate well into toxy, without much more effort: one has to disable special chars, define a mechanism for preserving state across unmap/map events, etc.
Krzysztof