[racket] message-box too small to display title
Hello Mr. Spier,
I ran into this issue recently-are you using racket on Windows out of
curiosity? In short, I think you need to set auto-resize to #t explicitly
upon init'ing your message.
I submitted problem report 12714 to track this.
#|Setting up the first frame and parent.|#
(define parent1 (new frame%
[label "Parent1"]
[width 200]
[height 200]
[enabled #t]))
#|Not working - messages sent to this frame appear to truncate past the
first digit. Adjusting the label below to a string longer than the string
sent to the messages% set-label method avoids the issue as well.|#
(define x-pos (new message%
[parent parent1]
[label "0"]))
#|This variant of x-pos works, resizing with new set-label requests and
thus avoiding the truncation. |#
#;(define x-pos (new message%
[parent parent1]
[label "0"]#|Setting the label to say, "Long label!"
avoids the behavior as well.|#
[auto-resize #t]))
(send parent1 show #t)
#|The second frame*pos combo-|#
(define parent2 (new frame%
[label "Parent2"]
[width 200]
[height 200]
[enabled #t]))
#|Here comes the canvas subclass-I'm looking to override on-event method to
grab the x-component of the mouse pos, and I want to have that constantly
updating the x-pos message%. |#
(define my-canvas% (class canvas%
(inherit get-dc)
(define/override (on-event mouse-event)
(define x (send mouse-event get-x))
(send x-pos set-label (number->string x)))
(super-new)))
(define canvas (new my-canvas% [parent parent2]
[label "Nothing yet."]))
(send parent2 show #t)
> On 20 April 2012 10:30, Harry Spier <vasishtha.spier at gmail.com> wrote:
>
>> I've created a simple message-box. It expands in width to display the
>> message, but if the title is longer than the message, then the title
>> is cut-off. Is there any way to have the message-box expand enough to
>> display the title in that case.
>>
>> Thanks,
>> Harry Spier
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120420/66e6c250/attachment.html>