On Sat, May 18, 2002 at 02:27:06PM -0300, Lalo Martins wrote: > On Sat, May 18, 2002 at 02:27:41PM +0100, James Hollingshead wrote: > > > > Fonts aren't necessarily monospaced, so I couldn't decide between > > trying to work out how many "M"s fit on a line and then wrapping at > > that, or being more complicated and having differing numbers of chars > > on each line. The second approach would I think either require lots of > > trial and error calls to pgSizeText() for every line, or maybe an > > array containing the size of each ascii char so we could calculate > > directly in the client. > > I propose a sollution for this is implemented in the server. > > PGREQ_WRAPTEXT > additional data: struct pgreqd_handlestruct > server response type: PG_RESPONSE_RET > > Given a handle to a widget, this reads the widget's current text, font and > width, and wraps the string corresponding to the widget's text so that it > fits the screen. > > (RFC: wrap at word-boundary or "dumb-wrap"?) > > Returns the length of the string after wrapping. > > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > > Perhaps there are other possibilities. One is, given a string handle and a > font and width, return a lot of strings; or allowing a widget to show a > string beginning from a given offset (then all of the necessary widgets > would show the same string, as far as the server is concerned, but each will > be showing a different part of it). Or, of course, making the label widget > multi-line with auto-wrapping ;-) > > James, as a side comment: couldn't this code use the textbox instead? What > would be the problems? Bookmarking? IIRC the textbox is already quite usable > for read-only plaintext.
Yes, this application definitely calls out for a useful textbox widget. However, the current code is inefficient and unstable. It really needs a complete rewrite, which I plan on doing very soon. Scrolling and bookmarking should be easy to do with the PG_WP_SCROLL* properties. As for word wrapping in other places like labels, that could be a font flag, and wrapping done at render-time. For large bodies of text this would be slow, though. That's what the textbox would be for, since I'm planning on having it store each line separately and wrap when necessary. (John's design) > > []s, > |alo > +---- > -- > It doesn't bother me that people say things like > "you'll never get anywhere with this attitude". > In a few decades, it will make a good paragraph > in my biography. You know, for a laugh. > -- > http://www.laranja.org/ mailto:[EMAIL PROTECTED] > pgp key: http://www.laranja.org/pessoal/pgp > > Eu jogo RPG! (I play RPG) http://www.eujogorpg.com.br/ > Python Foundry Guide http://www.sf.net/foundry/python-foundry/ > > _______________________________________________________________ > Hundreds of nodes, one monster rendering program. > Now that's a super model! Visit http://clustering.foundries.sf.net/ > > _______________________________________________ > Pgui-devel mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/pgui-devel -- Only you can prevent creeping featurism! _______________________________________________________________ Hundreds of nodes, one monster rendering program. Now that's a super model! Visit http://clustering.foundries.sf.net/ _______________________________________________ Pgui-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/pgui-devel
