another question.

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

another question.

pablo digonzelli
Hi.
How can I create dinamically a subView of a view ?
For example , I have a ContainerView and I want to add another containerView
dnamically
Tia


Reply | Threaded
Open this post in threaded view
|

Re: another question.

Bill Schwab
Pablo,

> I have a View , really StaticText view. I am displaying  a text on it.
> I want to set the width of the view in function of the text i'm displaying
> in.
> i use width: (text size * font pontSize)  method on the view.
> but, the view don't  adjust exactly to the text.
> it is a little wider .
>
> My question is: How can i adjust more exactly the size of the view.

You'll need to do something along the lines of

   ( Canvas forDesktop textExtent:'hello' ) x

to get the size of the string.  Actually, it's a little more complicated,
because you'll want to use the same font as the control.  Multiplying the
number of characters by the size of one character won't work unless you are
using a monospaced font.


> How can I create dinamically a subView of a view ?
> For example , I have a ContainerView and I want to add another
containerView
> dnamically

One answer is to go to

    http://needle.anest.ufl.edu/anest4/bills/

and get the Pane Holders package.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: another question.

Andy Bower
In reply to this post by pablo digonzelli
Pablo,

> How can I create dinamically a subView of a view ?
> For example , I have a ContainerView and I want to add another
containerView
> dnamically

I wrote a reply on this topic a couple of weeks back. See my messages posted
in the thread "Dolphin/98 question" on 27/2/01. Here's a snip from one reply
that demonstrates how to build a view programmatically and how to use the
layour managers to automatically format the view as it is resized.

For programmatic building of a view with a layout try this:

shell := ShellView new create.
shell layoutManager: (ProportionalLayout new vertical: true).

"Top pane fills 1/3 shell"
top := shell addSubView: ListView new.
top arrangement: 1 / 3. "Relative size of this view"
top backcolor: Color yellow.

"Splitter between top and bottom panes"
splitter := shell addSubView: Splitter new.
splitter arrangement: 0. "Not automatically sized"

"Bottom pane fills 2/3 shell by default"
bottom := shell addSubView: ContainerView new.
bottom arrangement: 2 / 3. "Relative size of this view"
bottom layoutManager: GridLayout new.

"Add some contents to the bottom pane"
button1 := bottom addSubView: PushButton new.
button1 text: 'Button1'.
button2 := bottom addSubView: PushButton new.
button2 text: 'Button2'.
button3 := bottom addSubView: CheckBox new.
button3 text: 'Check3'.

"Separate the views in the bottom pane"
bottom layoutManager horizontalGap: 15.

"Provide a gap around all views in bottom pane"
bottom insets: (20@20 corner: 20@20).

"Display the finished shell"
shell show.

This doesn't demonstrate the BorderLayout (a very useful layout manager, use
#north, #south, #east, #west and #center as arrangements) or the CardLayout
(which is automatically installed by a CardContainer view) but it should be
enough to get you started.

Best Regards,

Andy Bower
Dolphin Support
http://www.object-arts.com

---
Visit the Dolphin Smalltalk WikiWeb
http://www.object-arts.com/wiki/html/Dolphin/FrontPage.htm
---


Reply | Threaded
Open this post in threaded view
|

Re: another question.

pablo digonzelli
Thanks again Andy
Pablo
"Andy Bower" <[hidden email]> wrote in message
news:98iebb$21icn$[hidden email]...
> Pablo,
>
> > How can I create dinamically a subView of a view ?
> > For example , I have a ContainerView and I want to add another
> containerView
> > dnamically
>
> I wrote a reply on this topic a couple of weeks back. See my messages
posted
> in the thread "Dolphin/98 question" on 27/2/01. Here's a snip from one
reply

> that demonstrates how to build a view programmatically and how to use the
> layour managers to automatically format the view as it is resized.
>
> For programmatic building of a view with a layout try this:
>
> shell := ShellView new create.
> shell layoutManager: (ProportionalLayout new vertical: true).
>
> "Top pane fills 1/3 shell"
> top := shell addSubView: ListView new.
> top arrangement: 1 / 3. "Relative size of this view"
> top backcolor: Color yellow.
>
> "Splitter between top and bottom panes"
> splitter := shell addSubView: Splitter new.
> splitter arrangement: 0. "Not automatically sized"
>
> "Bottom pane fills 2/3 shell by default"
> bottom := shell addSubView: ContainerView new.
> bottom arrangement: 2 / 3. "Relative size of this view"
> bottom layoutManager: GridLayout new.
>
> "Add some contents to the bottom pane"
> button1 := bottom addSubView: PushButton new.
> button1 text: 'Button1'.
> button2 := bottom addSubView: PushButton new.
> button2 text: 'Button2'.
> button3 := bottom addSubView: CheckBox new.
> button3 text: 'Check3'.
>
> "Separate the views in the bottom pane"
> bottom layoutManager horizontalGap: 15.
>
> "Provide a gap around all views in bottom pane"
> bottom insets: (20@20 corner: 20@20).
>
> "Display the finished shell"
> shell show.
>
> This doesn't demonstrate the BorderLayout (a very useful layout manager,
use
> #north, #south, #east, #west and #center as arrangements) or the
CardLayout
> (which is automatically installed by a CardContainer view) but it should
be

> enough to get you started.
>
> Best Regards,
>
> Andy Bower
> Dolphin Support
> http://www.object-arts.com
>
> ---
> Visit the Dolphin Smalltalk WikiWeb
> http://www.object-arts.com/wiki/html/Dolphin/FrontPage.htm
> ---
>
>
>
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: another question.

pablo digonzelli
In reply to this post by Andy Bower
Andy,
I have 2 textEdit , i use your suggestion but when I apply this, the first
one is a little wider as I expect and the another is a little shorter.
Do yo know why thishappend?.
Pablo
"Andy Bower" <[hidden email]> wrote in message
news:98iebb$21icn$[hidden email]...
> Pablo,
>
> > How can I create dinamically a subView of a view ?
> > For example , I have a ContainerView and I want to add another
> containerView
> > dnamically
>
> I wrote a reply on this topic a couple of weeks back. See my messages
posted
> in the thread "Dolphin/98 question" on 27/2/01. Here's a snip from one
reply

> that demonstrates how to build a view programmatically and how to use the
> layour managers to automatically format the view as it is resized.
>
> For programmatic building of a view with a layout try this:
>
> shell := ShellView new create.
> shell layoutManager: (ProportionalLayout new vertical: true).
>
> "Top pane fills 1/3 shell"
> top := shell addSubView: ListView new.
> top arrangement: 1 / 3. "Relative size of this view"
> top backcolor: Color yellow.
>
> "Splitter between top and bottom panes"
> splitter := shell addSubView: Splitter new.
> splitter arrangement: 0. "Not automatically sized"
>
> "Bottom pane fills 2/3 shell by default"
> bottom := shell addSubView: ContainerView new.
> bottom arrangement: 2 / 3. "Relative size of this view"
> bottom layoutManager: GridLayout new.
>
> "Add some contents to the bottom pane"
> button1 := bottom addSubView: PushButton new.
> button1 text: 'Button1'.
> button2 := bottom addSubView: PushButton new.
> button2 text: 'Button2'.
> button3 := bottom addSubView: CheckBox new.
> button3 text: 'Check3'.
>
> "Separate the views in the bottom pane"
> bottom layoutManager horizontalGap: 15.
>
> "Provide a gap around all views in bottom pane"
> bottom insets: (20@20 corner: 20@20).
>
> "Display the finished shell"
> shell show.
>
> This doesn't demonstrate the BorderLayout (a very useful layout manager,
use
> #north, #south, #east, #west and #center as arrangements) or the
CardLayout
> (which is automatically installed by a CardContainer view) but it should
be

> enough to get you started.
>
> Best Regards,
>
> Andy Bower
> Dolphin Support
> http://www.object-arts.com
>
> ---
> Visit the Dolphin Smalltalk WikiWeb
> http://www.object-arts.com/wiki/html/Dolphin/FrontPage.htm
> ---
>
>
>
>
>
>
>