First time here? Check out the FAQ!
x

How do I use MaximumWindowExtent to set a view's dimensions?

0 votes
142 views

When I create a View, I would like to specify a square that scales well to different displays.

In the dialog that defines the view, I am presented with a default Box that specifies dimensions as percentages of the width and height, based on, presumably either MaximumWindowExtent or MinimumWindowExtent.

However, I want to base the width off of the height.  Something like:

0.02@0.02 corner: (MaximumWindowExtent: y*0.75)@(MaximumWindowExtent: y*0.75)

If I cannot initialize it at creation time, what's the syntax to change it onEntry in the InitialState?

asked Sep 28, 2015 in Capytalk & Smalltalk by kevin-cole (Adept) (1,050 points)
Trial and error is getting me partially there, though it seems ugly. After defining a view called "Box", I added the following to onEntry in InitialState:

Box corner: (MaximumWindowExtent y asFloat / MaximumWindowExtent x asFloat) @ (MaximumWindowExtent y asFloat / MaximumWindowExtent y asFloat).

(I used the "y / y" portion because I don't think I'll be staying with 1 as the height and it will be easier to remember and modify if I keep the ratios in my head.)

Debug := true shows me that I'm getting the approximate values that I want. I think.

However, I don't know what to add after that to force it to redisplay the new size.

Please log in or register to answer this question.

...