default   Racket Bugs
Main PageQuick QueryStandard QueryAdvanced QueryHelp
Log in

View Problem Report: 12714

send email to interested parties or send email followup to audit-trail
Reporter's email: paddy dot mahoney at gmail dot com
Number: 12714
Category: all
Synopsis: auto-resize doesn't default to true > docs or implementation issue?
Class: sw-bug
Responsible: samth
Notify-List:
Severity: non-critical
Priority: medium
State: closed
Confidential: no
Arrival-Date: Fri Apr 20 15:28:01 -0400 2012
Closed-Date: Sun Jun 03 11:07:41 -0400 2012
Last-Modified: Mon Feb 18 23:22:20 -0500 2013
Originator: Patrick Mahoney
Organization: plt
Submitter-Id: unknown
Release: 5.1
Environment: windows "Windows NT 5.1 (Build 2600) Service Pack 3" (win32\i386\3m) (get-display-depth) = 32
Human Language: english
(current-memory-use) 226086692

Collections:
("D:\\Documents and Settings\\Patrick Mahoney\\Application Data\\Racket\\5.1\\collects"
(non-existent-path))
("D:\\Program Files\\Racket\\collects"
("2htdp" "algol60" "at-exp" "browser" "combinator-parser" "compiler" "config" "data" "datalog" "defaults" "deinprogramm" "drracket" "drscheme" "dynext" "embedded-gui" "eopl" "errortrace" "ffi" "file" "framework" "frtime" "games" "graphics" "gui-debugger" "help" "hierlist" "htdp" "html" "icons" "info-domain" "lang" "launcher" "lazy" "macro-debugger" "make" "mred" "mrlib" "mysterx" "mzcom" "mzlib" "mzscheme" "net" "openssl" "parser-tools" "picturing-programs" "plai" "planet" "plot" "preprocessor" "profile" "r5rs" "r6rs" "racket" "racklog" "rackunit" "raco" "reader" "readline" "redex" "rnrs" "s-exp" "scheme" "schemeunit" "scribble" "scribblings" "scriblib" "setup" "sgl" "slatex" "slideshow" "srfi" "stepper" "string-constants" "swindle" "syntax" "syntax-color" "teachpack" "test-box-recovery" "test-engine" "tex2page" "texpict" "trace" "typed" "typed-scheme" "unstable" "version" "web-server" "wxme" "xml"))

Computer Language: (("Determine language from source") (#(#t print mixed-fraction-e #f #t debug) (default) #() "#lang racket\n" #t #t))
Description: #lang racket
(require racket/gui/base)

#|Problem: I have a message% control called x-pos parented by a frame% called parent1. I have a canvas% subclass called canvas parented under frame% parent2. I would like x-pos to always show the current x coordinate of the mouse position over canvas, and for this to be kept up to date as the mouse moves. When the mouse moves, message is updated and displays, but only the first digit. It truncates the string sent to it if the label upon message% init is smaller than the label string sent to it.

message% does not resize automatically, and I needed to set the auto-resize field to #t. It also didn't show in my original test-sort of a heisenbug because I used a really long initial label in my test scenario.

From
http://docs.racket-lang.org/gui/message_.html
"If auto-resize is not #f, then automatic resizing is initially enanbled (see auto-resize), and the message% object’s graphical minimum size is as small as possible." -> this doesn't appear to be the case here. Windows XP, Racket 5.1

I don't have a linux box to test atm, but I wonder if the default for the auto-size field is #t there. If so, either the docs are incorrect, or the windows implementation. If not, docs need to be updated. I'd be glad to help in any way possible.|#
File Attachments:
How-To-Repeat: #lang racket
(require racket/gui/base)


#|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)
 
Fix:
Release-Note:
Unformatted:

send email to interested parties or send email followup to audit-trail

Audit Trail:

From: Matthew Flatt <mflatt at cs.utah.edu>
To: paddy.mahoney at gmail.com, bugs at racket-lang.org
Cc: nobody at racket-lang.org, bug-notification at racket-lang.org
Subject: Re: [racket-bug] all/12714: auto-resize doesn't default to true > docs or implementation issue?
Date: Wed, 25 Apr 2012 18:04:45 -0600

 At Fri, 20 Apr 2012 15:28:02 -0400, paddy.mahoney at gmail.com wrote:
 > From
 > http://docs.racket-lang.org/gui/message_.html
 > "If auto-resize is not #f, then automatic resizing is initially enanbled (see 
 > auto-resize), and the message% object's graphical minimum size is as 
 > small as possible." -> this doesn't appear to be the case here. Windows XP, 
 > Racket 5.1
 
 It might be clearer to say
 
  If `auto-resize' is specified as true value, then...
 
 but the convention throughout the documentation is that optional
 arguments have defaults, and the prose assumes a default if no explicit
 value is provided for the argument. Defaults are shown in the blue box
 alongside contracts, and the blue box for the `message%' constructor,
 ends with
 
   auto-resize : any/c = #f
 
 indicating that `auto-resize' is #f by default.
 

State changed from "open" to "closed" by samth at Sun, 03 Jun 2012 11:07:41 -0400
Reason>>> The default is specified in the blue box.


Responsible changed from "nobody" to "samth" by eli at Mon, 18 Feb 2013 23:22:20 -0500
Reason>>> samth closed