Get-size should work, can you provide a example that illustrates the 
problem?  

The only tricky bit is that the actual size of a widget is only computed 
after it is shown.  Here is an example:

    #lang racket
    (require racket/gui)
    
    (define toplevel (new frame% [label "hello"] [width 200] [height 200]))
    (define p (new panel% [parent toplevel] [min-width 100] [min-height 
100]))
    
    (define-values (w h) (send p get-size))
    (printf "Before show: w = ~a, h = ~a~%" w h)
    
    (send toplevel show #t)
    
    (define-values (w1 h1) (send p get-size))
    (printf "After show: w = ~a, h = ~a~%" w1 h1)

This prints out:

    Before show: w = 0, h = 0
    After show: w = 184, h = 161

You can also override the "on-size" method on the panel% class to be 
notified of size changes as they happen.

Best Regards,
Alex.


On Thursday, February 22, 2018 at 12:01:39 PM UTC+8, David Alkire wrote:
>
> Is it possible to get the current size (width and height) of a panel% from 
> racket/guilty? I haven't been able to figure out a way. I set a min-width 
> and min-height in my panel and allow them to be stretchable. If they do 
> stretch, I want to be able to know their current size. Sending get-size or 
> get-width to the panel gives me 1 instead of my min-width of 200, for 
> example. I get 200 if I send min-width, but I want to be sure I can react 
> to changes in size appropriately.
>
> Any help is appreciated.
>
> Thanks,
> David
>
>

-- 
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