resizing views programatically

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

resizing views programatically

Gary Overgard
How do I resize a view programmatically?  I have tried a few variations such
as setting the extent, & using show, invalidating the rectangle, but so far
have not come across the one that works.  Note that the views I am trying to
resize are typically in container views.
--thanks in advance
   Gary Overgard


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Stefan Schmiedl
On Tue, 29 Jan 2002 07:16:23 -0800,
Gary Overgard <[hidden email]> wrote:
> How do I resize a view programmatically?  I have tried a few variations such
> as setting the extent, & using show, invalidating the rectangle, but so far
> have not come across the one that works.  Note that the views I am trying to
> resize are typically in container views.
> --thanks in advance
>    Gary Overgard
>

hmmm... if your containers have layout managers,
you might consult with them for resizing the views,
as they are the ones that are responsible for placement
issues. mostly.

what kind of layout do you have? The subview-tree (lower left
corner of view editor) and a listing of the layoutmanagers in use
would be helpful here.

s.
--
Stefan Schmiedl
EDV-Beratung, Programmierung, Schulung
Loreleystr. 5, 94315 Straubing, Germany
Tel. (0 94 21) 74 01 06
Public Key: http://xss.de/stefan.public

shhhh ... I can't hear my code!


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Gary Overgard
My first attempt was to look at how the splitter resized the 2 views.  I
then figured out how to access the views it was using & called the
proportional layout managers #reposition:to: method.  But this had no
effect, although curiously looking at the normal execution of the method, vs
my call to it, all the values seem to be the same.  So it may have something
to do with the windows calls higher in the stack.

I then decided to use the 'miss' method (make it simpler, stupid), and
simply tried to resize a button in one of the container views.  From what I
can tell the container view should not have impacted any of the methods I
was using, and as I had an inspecton on the button itself, there was no
question of the methods ending up at the right receiver.  So after trying a
number of experiments unsuccessfully, I figured that someone in the group
probably already had the answer.

still clueless in colorado
--Gary

"Stefan Schmiedl" <[hidden email]> wrote in message
news:a36hnb$1633m3$[hidden email]...
> On Tue, 29 Jan 2002 07:16:23 -0800,
> Gary Overgard <[hidden email]> wrote:
> > How do I resize a view programmatically?  I have tried a few variations
such
> > as setting the extent, & using show, invalidating the rectangle, but so
far
> > have not come across the one that works.  Note that the views I am
trying to

> > resize are typically in container views.
> > --thanks in advance
> >    Gary Overgard
> >
>
> hmmm... if your containers have layout managers,
> you might consult with them for resizing the views,
> as they are the ones that are responsible for placement
> issues. mostly.
>
> what kind of layout do you have? The subview-tree (lower left
> corner of view editor) and a listing of the layoutmanagers in use
> would be helpful here.
>
> s.
> --
> Stefan Schmiedl
> EDV-Beratung, Programmierung, Schulung
> Loreleystr. 5, 94315 Straubing, Germany
> Tel. (0 94 21) 74 01 06
> Public Key: http://xss.de/stefan.public
>
> shhhh ... I can't hear my code!


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Ian Bartholomew-6
Gary,

Using a ClassBrowser as an example. Evaluate a line at a time.

Show a CHB
c := ClassBrowserShell show.

Resize it's classes (top left tree) view. Nothing happens visually.
(c view viewNamed: 'classes') arrangement: 2.

Force a redraw of the whole view. View updated.
c view invalidate

So if the parent view has a LayoutManager you change the arrangement aspect
of your sub view and then get everything redrawn

Buttons should be resizable if there is no LayoutManager involved. Evaluate
the first three lines to create a Shell with a PushButton ...

s := Shell show.
s view addSubView: (p := PushButton new).
p position: 100@100.

... then resize it

p extent: 10@10

Regards
    Ian


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Andy Bower
In reply to this post by Gary Overgard
Gary,

> My first attempt was to look at how the splitter resized the 2 views.  I
> then figured out how to access the views it was using & called the
> proportional layout managers #reposition:to: method.  But this had no
> effect, although curiously looking at the normal execution of the method,
vs
> my call to it, all the values seem to be the same.  So it may have
something
> to do with the windows calls higher in the stack.
>
> I then decided to use the 'miss' method (make it simpler, stupid), and
> simply tried to resize a button in one of the container views.  From what
I
> can tell the container view should not have impacted any of the methods I
> was using, and as I had an inspecton on the button itself, there was no
> question of the methods ending up at the right receiver.  So after trying
a
> number of experiments unsuccessfully, I figured that someone in the group
> probably already had the answer.

It's still not clear what you are trying to do. If you have views that are
under the control of a layout manager (i.e. the are the children of a
container with a non-nil layout manager) then you shouldn't be trying to
resize them manually. Try this in a workspace:

parent := ShellView new show.
button := parent addSubView: PushButton new.
button position: 50@50.
button extent: 100@100.

Now what could be simpler than that!

Best Regards,
Andy Bower
Dolphin Support
http://www.object-arts.com
---
Are you trying too hard?
http://www.object-arts.com/Relax.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Gary Overgard
If they are not in a container view, then it works just as you have shown
below.  What I was after was having a couple of toggle buttons that would
either maximize or mininimize a grid view, and a text view, along with using
a splitter between the 2.  But its not absolutely necessary, and now I know
why I have not seen this before!
Thanks for the input,
  Gary Overgard


"Andy Bower" <[hidden email]> wrote in message
news:a36uvr$158ioe$[hidden email]...

>
> It's still not clear what you are trying to do. If you have views that are
> under the control of a layout manager (i.e. the are the children of a
> container with a non-nil layout manager) then you shouldn't be trying to
> resize them manually. Try this in a workspace:
>
> parent := ShellView new show.
> button := parent addSubView: PushButton new.
> button position: 50@50.
> button extent: 100@100.
>
> Now what could be simpler than that!
>
> Best Regards,
> Andy Bower
> Dolphin Support
> http://www.object-arts.com
> ---
> Are you trying too hard?
> http://www.object-arts.com/Relax.htm
> ---
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Stefan Schmiedl
On Tue, 29 Jan 2002 18:53:30 -0800,
Gary Overgard <[hidden email]> wrote:
> If they are not in a container view, then it works just as you have shown
> below.  What I was after was having a couple of toggle buttons that would
> either maximize or mininimize a grid view, and a text view, along with using
> a splitter between the 2.  But its not absolutely necessary, and now I know
> why I have not seen this before!

Maybe the package http://xss.de/dolphin/MaximizingEditor.pac gets you started.

btw: do we have some central place for putting up code snippets?

s.
--
Stefan Schmiedl
EDV-Beratung, Programmierung, Schulung
Loreleystr. 5, 94315 Straubing, Germany
Tel. (0 94 21) 74 01 06
Public Key: http://xss.de/stefan.public

shhhh ... I can't hear my code!


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Gary Overgard
Awesome!  This is exactly what I was looking for.  Thanks for the code
snippet :)
  --Gary

"Stefan Schmiedl" <[hidden email]> wrote in message
news:a38agh$125ac7$[hidden email]...
> On Tue, 29 Jan 2002 18:53:30 -0800,
> Gary Overgard <[hidden email]> wrote:
> > If they are not in a container view, then it works just as you have
shown
> > below.  What I was after was having a couple of toggle buttons that
would
> > either maximize or mininimize a grid view, and a text view, along with
using
> > a splitter between the 2.  But its not absolutely necessary, and now I
know
> > why I have not seen this before!
>
> Maybe the package http://xss.de/dolphin/MaximizingEditor.pac gets you
started.

>
> btw: do we have some central place for putting up code snippets?
>
> s.
> --
> Stefan Schmiedl
> EDV-Beratung, Programmierung, Schulung
> Loreleystr. 5, 94315 Straubing, Germany
> Tel. (0 94 21) 74 01 06
> Public Key: http://xss.de/stefan.public
>
> shhhh ... I can't hear my code!
>


Reply | Threaded
Open this post in threaded view
|

Re: resizing views programatically

Stefan Schmiedl
"Gary Overgard" <[hidden email]> wrote in message news:<a38t7v$sdo$[hidden email]>...

> Awesome!  This is exactly what I was looking for.  Thanks for the code

> snippet :)

>   --Gary


thanks for posting a problem I could solve during breakfast :-)

s.

--

Stefan Schmiedl

EDV-Beratung, Programmierung, Schulung

Loreleystr. 5, 94315 Straubing, Germany

Tel. (0 94 21) 74 01 06

Public Key: http://xss.de/stefan.public


shhhh ... I can't hear my code!