Container presenters and scrollbars

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

Container presenters and scrollbars

Günther Schmidt
Hi,

thanks to advice from Ian and Runar I've been able to add subpresenters
programaticaly (using.

No another problem comes up: Scrollbars.

I need the Containerpresenter to show vertical OR horizontal Scrollbars
when a subpresenter has been added with a position outside the visual range.

I've certainly tried just about anything now I could think of, but no luck.

HELP!!!

Guenther


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Ian Bartholomew-19
Günther,

> I need the Containerpresenter to show vertical OR horizontal Scrollbars
> when a subpresenter has been added with a position outside the visual
> range.

It sounds like you need to put the ContainerView inside a
ScrollingDecorator - try this in a workspace.

s := Shell show.
s view addSubView: (sc := ScrollingDecorator new).
sc addSubView: (cv := ContainerView new).
cv extent: 1000@1000.
cv addSubView: (t := TextEdit new).
t position: 10@10.
cv addSubView: (t := TextEdit new).
t position: 900@900.

The problem (if it is a problem for you) is that you will then always see
the scroll bars.  You may have to do a bit of a shuffle if that's no good
and only add a ScrollingDecorator if you are going to need it.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Chris Uppal-3
Ian, Günther,

> The problem (if it is a problem for you) is that you will then always see
> the scroll bars.  You may have to do a bit of a shuffle if that's no good
> and only add a ScrollingDecorator if you are going to need it.

Not sure what you mean by this ?

In general I find that ScrollingDecorator can be akward when used with a
sub-view that doesn't have a #preferredExtent.  The ScollingDecorator asks the
sub-view how big it wants to be, but the sub-view -- lacking a
#preferredExtent -- defaults to answering its current size, so the
ScrollingDecorator can end up getting a bit confused...

This small modification to your script shows the scrollbars appearing and
disappearing as they are needed.

s := Shell show.
s view layoutManager: (BorderLayout new).

s view addSubView: (sc := ScrollingDecorator new).
sc arrangement: #center.

sc addSubView: (cv := ContainerView new).
cv
 backcolor: (Color blue); "so we can see it"
 preferredExtent: 300@300;
 usePreferredExtent: true.

cv addSubView: (t := TextEdit new).
t position: 10@10.
cv addSubView: (t := TextEdit new).
t position: 200@280.

Resizing the window will change the size of the ScrollingDecorator, but 'cv' is
fixed at 300@300 so the bars should appear only when you make the window
smallish.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Ian Bartholomew-19
Chris.

> This small modification to your script shows the scrollbars appearing and
> disappearing as they are needed.

You are indubitably right.  My recollection that ScrollingDecorators always
displayed the scroll bars was so strong that I didn't even bother checking
it <sigh>.

Apologies to all for the misinformation.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Günther Schmidt
In reply to this post by Ian Bartholomew-19
Dear Ian,

thanks, this is getting me closer to where I want to get.


Is there a way to make cv automaticaly adjust its extent?

Like if cv's original extent would be 100@100 and the adding the text
subpresenter at 900@900?

Thanks

Günther

Ian Bartholomew schrieb:

> Günther,
>
>
>>I need the Containerpresenter to show vertical OR horizontal Scrollbars
>>when a subpresenter has been added with a position outside the visual
>>range.
>
>
> It sounds like you need to put the ContainerView inside a
> ScrollingDecorator - try this in a workspace.
>
> s := Shell show.
> s view addSubView: (sc := ScrollingDecorator new).
> sc addSubView: (cv := ContainerView new).
> cv extent: 1000@1000.
> cv addSubView: (t := TextEdit new).
> t position: 10@10.
> cv addSubView: (t := TextEdit new).
> t position: 900@900.
>
> The problem (if it is a problem for you) is that you will then always see
> the scroll bars.  You may have to do a bit of a shuffle if that's no good
> and only add a ScrollingDecorator if you are going to need it.
>


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Schwab,Wilhelm K
Günther,

> Is there a way to make cv automaticaly adjust its extent?
>
> Like if cv's original extent would be 100@100 and the adding the text
> subpresenter at 900@900?

Yes - just do it :)  How, you ask?  Unless I have missed a change in the
thread, your goal is programmatic construction.  Editing via the view
composer will typically "force" you to fix the container size.

What I typically do for programmatic construction (see MVP Generators
base in my goodies) is to let a proportional layout manager do all of
the work of arranging the sub presenters, so all I need to do is set the
container size based on the number of them (well, the sum or their
arrangements to be more accurate), and then conditionally change to a
framing layout and tweak the couple of arrangement aspects (per view)
that aren't the way I want them after Andy did all of the hard work for
me.  It's shameless, but it works.

Either way, tricks such as in ViewGenerator>>postGeneration should get
you going.  Note the iteration of managed subviews, and possibly
invalidating layout, etc.  A simple minded max of the lower right of
each managed view's rectangle should be a good guess at your desired
extent; you will probably want to add a small border around them, and
that might even be obtainable from the layout manaager.

Have a good one,

Bill

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


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Ian Bartholomew-19
In reply to this post by Günther Schmidt
Günther,

> Is there a way to make cv automaticaly adjust its extent?
>
> Like if cv's original extent would be 100@100 and the adding the text
> subpresenter at 900@900?

I don't think it can be done automatically but I would have thought it was
easy enough to check if the subpresenter was going to be placed outside of
the current containers boundary and, if so, adjust the containers extent
accordingly.  For example (using Chris' improved example)

s := Shell show.
s view layoutManager: (BorderLayout new).
s view addSubView: (sc := ScrollingDecorator new).
sc arrangement: #center.
sc addSubView: (cv := ContainerView new).
cv
    backcolor: (Color blue); "so we can see it"
    preferredExtent: 300@300;
    usePreferredExtent: true.
cv addSubView: (t := TextEdit new).
t position: 30@30.
cv addSubView: (t := TextEdit new).
t position: 200@280.

Now, if you want to add a new text presenter at 900@980 you could either
just expand the container first ....

cv preferredExtent: 1000@1000.
cv addSubView: (t := TextEdit new).
t position: 900@980

... or calculate it afterwards

cv addSubView: (t := TextEdit new).
t position: 900@980.
maxX := 0.
maxY := 0.
cv subViews do: [:each |
    maxX := maxX max: (each position + each extent) x.
    maxY := maxY max: (each position + each extent) y].
cv preferredExtent: (maxX @ maxY) + 8

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Günther Schmidt
In reply to this post by Schwab,Wilhelm K
Dear Bill,

thanks!!

I was well aware of the existence of the goodie packages, but being so
at the very begining with Dolphin and Smalltalk I didn't yet dare to
look into them any further. :)

But be sure this one will be the very first!!



Bill Schwab schrieb:

> Günther,
>
>> Is there a way to make cv automaticaly adjust its extent?
>>
>> Like if cv's original extent would be 100@100 and the adding the text
>> subpresenter at 900@900?
>
>
> Yes - just do it :)  How, you ask?  Unless I have missed a change in the
> thread, your goal is programmatic construction.  Editing via the view
> composer will typically "force" you to fix the container size.
>
> What I typically do for programmatic construction (see MVP Generators
> base in my goodies) is to let a proportional layout manager do all of
> the work of arranging the sub presenters, so all I need to do is set the
> container size based on the number of them (well, the sum or their
> arrangements to be more accurate), and then conditionally change to a
> framing layout and tweak the couple of arrangement aspects (per view)
> that aren't the way I want them after Andy did all of the hard work for
> me.  It's shameless, but it works.
>
> Either way, tricks such as in ViewGenerator>>postGeneration should get
> you going.  Note the iteration of managed subviews, and possibly
> invalidating layout, etc.  A simple minded max of the lower right of
> each managed view's rectangle should be a good guess at your desired
> extent; you will probably want to add a small border around them, and
> that might even be obtainable from the layout manaager.
>
> Have a good one,
>
> Bill
>


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Günther Schmidt
In reply to this post by Schwab,Wilhelm K
Bill,

I keep getting error messages like

11:44:54, Mittwoch, 26. Januar 2005: 'ContainerView does not understand
#selfOrReferee'
ContainerView(Object)>>doesNotUnderstand:
ViewGenerator>>basicPastePresenterClass:viewResourceName:as:at:extent:inContextView:
ViewGenerator>>pastePresenterClass:viewResourceName:as:at:extent:inContextView:byReference:
ViewGenerator>>pastePresenterClass:viewResourceName:as:at:extent:byReference:
ViewGenerator>>pastePresenterClass:viewResourceName:as:at:extent:withLabel:byReference:
[] in ViewGenerator class>>example
[] in ViewGenerator>>generateView:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
ViewGenerator>>generateView:
ViewGenerator class>>example
UndefinedObject>>{unbound}doIt
CompiledExpression>>value:
SmalltalkWorkspace>>evaluateRange:ifFail:debug:
SmalltalkWorkspace>>evaluateItIfFail:debug:
SmalltalkWorkspace>>evaluateItIfFail:
SmalltalkWorkspace>>evaluateIt
Symbol>>forwardTo:
CommandDescription>>performAgainst:
[] in Command>>value
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
Command>>value
ShellView>>performCommand:
SmalltalkWorkspaceDocument(Shell)>>performCommand:
CommandQuery>>perform
DelegatingCommandPolicy(CommandPolicy)>>route:
[] in ShellView(View)>>onCommand:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:
Cursor>>showWhile:
ShellView(View)>>onCommand:
ShellView(View)>>wmCommand:wParam:lParam:
ShellView(View)>>dispatchMessage:wParam:lParam:
[] in InputState>>wndProc:message:wParam:lParam:cookie:
BlockClosure>>ifCurtailed:
ProcessorScheduler>>callback:evaluate:
InputState>>wndProc:message:wParam:lParam:cookie:
ShellView>>translateAccelerator:
ShellView>>preTranslateKeyboardInput:
ShellView(View)>>preTranslateMessage:
InputState>>preTranslateMessage:
InputState>>pumpMessage:
InputState>>loopWhile:
InputState>>mainLoop
[] in InputState>>forkMain
ExceptionHandler(ExceptionHandlerAbstract)>>markAndTry
[] in ExceptionHandler(ExceptionHandlerAbstract)>>try:
BlockClosure>>ifCurtailed:
BlockClosure>>ensure:



when I try to run your goodies, the one above and others too.

Could I possibly be trying to run an old version of your goodies?
I'm using Dolphin XP 5.1.3 here.

Günther


Bill Schwab schrieb:

> Günther,
>
>> Is there a way to make cv automaticaly adjust its extent?
>>
>> Like if cv's original extent would be 100@100 and the adding the text
>> subpresenter at 900@900?
>
>
> Yes - just do it :)  How, you ask?  Unless I have missed a change in the
> thread, your goal is programmatic construction.  Editing via the view
> composer will typically "force" you to fix the container size.
>
> What I typically do for programmatic construction (see MVP Generators
> base in my goodies) is to let a proportional layout manager do all of
> the work of arranging the sub presenters, so all I need to do is set the
> container size based on the number of them (well, the sum or their
> arrangements to be more accurate), and then conditionally change to a
> framing layout and tweak the couple of arrangement aspects (per view)
> that aren't the way I want them after Andy did all of the hard work for
> me.  It's shameless, but it works.
>
> Either way, tricks such as in ViewGenerator>>postGeneration should get
> you going.  Note the iteration of managed subviews, and possibly
> invalidating layout, etc.  A simple minded max of the lower right of
> each managed view's rectangle should be a good guess at your desired
> extent; you will probably want to add a small border around them, and
> that might even be obtainable from the layout manaager.
>
> Have a good one,
>
> Bill
>


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Ian Bartholomew-19
Günther,

> Could I possibly be trying to run an old version of your goodies?
> I'm using Dolphin XP 5.1.3 here.

Any particular reason why you aren't using 5.1.4 (just interested)

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Günther Schmidt
Ian Bartholomew schrieb:
> Günther,
>
>
>>Could I possibly be trying to run an old version of your goodies?
>>I'm using Dolphin XP 5.1.3 here.
>
>
> Any particular reason why you aren't using 5.1.4 (just interested)
>


Sorry,

I am!

I didn't look :-( first.


Reply | Threaded
Open this post in threaded view
|

Blind, I am so

Günther Schmidt
In reply to this post by Günther Schmidt
Blind!

The Dolphin System Folder Window is already doing exactly what I need!

AAAAAAAAAHHHHH!


Reply | Threaded
Open this post in threaded view
|

Re: Container presenters and scrollbars

Schwab,Wilhelm K
In reply to this post by Günther Schmidt
Günther,

> I keep getting error messages like
>
> 11:44:54, Mittwoch, 26. Januar 2005: 'ContainerView does not understand
> #selfOrReferee'

Sorry about that.  See the code below.


> when I try to run your goodies, the one above and others too.
>
> Could I possibly be trying to run an old version of your goodies?
> I'm using Dolphin XP 5.1.3 here.

The problem is one of packaging on my end.  I have a base package that
contains things that I want available to all of my software, and it
clearly contains things that are needed by my goodies too.  Not all of
it is releasable, so I will probably need to split it into two packages.

Have a good one,

Bill


!ReferenceView methodsFor!

selfOrReferee
        "Having problems w/ reference views vs. ordinary views"

        ^self referee

! !
!ReferenceView categoriesFor: #selfOrReferee!accessing!must not
strip!public! !

!View methodsFor!

selfOrReferee
        "Having problems w/ reference views vs. ordinary views"

        ^self
! !
!View categoriesFor: #selfOrReferee!accessing!must not strip!public! !



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