Hello all,

So I'm trying to write a social networking application using Racket's
GUI toolkit.  Most if it is going well, but the tricky thing is that the
user content has rich text (coming from HTML)... a simple message% won't
do, since I need to insert links and text and images and etc, but
luckily the editor% tools seem to be working well enough.  I'm doing
something like the following:

(define freezable-text%
  (class text:hide-caret/selection%
    (inherit begin-edit-sequence end-edit-sequence
             get-max-width find-snip position-location)
    (define immutable? #f)
    (define/public (freeze!)
      (set! immutable? #t))
    (define/public (thaw!)
      (set! immutable? #f))
    (define/augment (can-insert? start len)
      (not immutable?))
    (define/augment (can-delete? start len)
      (not immutable?))
    (super-new)))

(define a-frame (new frame% [label "foo"]))
(define ec (new editor-canvas%
                [parent a-frame]
                [style '(no-scroll no-vscroll)]))
(define a-text (new freezable-text%
                    [auto-wrap #t]))
(send ec set-editor text)
(send a-text insert "Blah blah blah\n\nblah blah")
(send a-text freeze!)

So now I've got some text that renders okay, it line wraps, etc etc.
The problem is, I want to add a panel with a bunch of these, and I want
each of these "rich text" things to be exactly the height of their
contents.  I can't figure out how to do it... either I have
stretchable-text set to #t and I'm stuck with whatever size it scales
to, or I set stretchable-text to #f and the rich text canvas is only a
few pixels high... not enough to see any content.

I'm going to be blitting a "timeline", so the behavior I'd really like
is to have each of these be the appropriate height of their content, and
the panel to have hscroll auto-enabled so that can be scrolled if
needed.

I thought about setting the minimum height, but I can't seem to figure
out how to get the value of the full "text contents" height in pixels...

Any ideas?  Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to