Home > Archive > Smalltalk > March 2007 > Help with Sync of Subcanvas scrolling
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Help with Sync of Subcanvas scrolling
|
|
| lopemanc@swbell.net 2007-03-04, 7:10 pm |
| Hi guys,
Quick question. Code just not clicking.
Need to sync scrolling of 2 subcanvases. Preferably one with a scroll
bar and one without. Looked at SlaveScrollWrapper and set
scrollOffsetHolder:. But must be messing up somewhere. Probally
during the postBuildWith: hook. Anyway, any help is greatly
appreciated.
Thanks,
Chris
| |
| maarten 2007-03-14, 7:17 pm |
| Hi Chris,
Just an example of how linked a dataset to (gant)view.
I declared two events in PostOpenWith:>
(self widgetAt: #Dataset1) when: #scrollDown
do: [self gantView scroll: self scrollBarPosition].
(self widgetAt: #Dataset1) when: #scrollUp
do: [self gantView scroll: self scrollBarPosition]
<These will tell my GantView to scrolldown with the DataSet>
scrollBarPosition
^(self builder componentAt: #Dataset1) widget scrollOffset value
<I added a scrollOffset accesor to get my hands on the instance variable
in use by ScrollingView >
<In GantView I redeclared scrollOffsetHolder: as used by VisualComponent>
scrollOffsetHolder: aValueHolder
myScroll := aValueHolder.
^self
<scroll: will simply do:>
scroll: aPoint
myScroll value: aPoint
Anyway the above thing works and only the accessor method scrollOffset
was actually added to the system.
@+,Maarten
lopemanc@swbell.net a écrit :
> Hi guys,
>
> Quick question. Code just not clicking.
>
> Need to sync scrolling of 2 subcanvases. Preferably one with a scroll
> bar and one without. Looked at SlaveScrollWrapper and set
> scrollOffsetHolder:. But must be messing up somewhere. Probally
> during the postBuildWith: hook. Anyway, any help is greatly
> appreciated.
>
> Thanks,
>
> Chris
>
| |
| lopemanc@swbell.net 2007-03-15, 7:16 pm |
| On Mar 14, 4:28 pm, maarten <maarten.most...@wanadoo.fr> wrote:[color=darkred]
> Hi Chris,
>
> Just an example of how linked a dataset to (gant)view.
>
> I declared two events in PostOpenWith:>
>
> (self widgetAt: #Dataset1) when: #scrollDown
> do: [self gantView scroll: self scrollBarPosition].
> (self widgetAt: #Dataset1) when: #scrollUp
> do: [self gantView scroll: self scrollBarPosition]
>
> <These will tell my GantView to scrolldown with the DataSet>
>
> scrollBarPosition
> ^(self builder componentAt: #Dataset1) widget scrollOffset value
>
> <I added a scrollOffset accesor to get my hands on the instance variable
> in use by ScrollingView >
>
> <In GantView I redeclared scrollOffsetHolder: as used by VisualComponent>
>
> scrollOffsetHolder: aValueHolder
> myScroll :=3D aValueHolder.
> ^self
>
> <scroll: will simply do:>
>
> scroll: aPoint
> myScroll value: aPoint
>
> Anyway the above thing works and only the accessor method scrollOffset
> was actually added to the system.
>
> @+,Maarten
>
> lopem...@swbell.net a =E9crit :
>
>
>
>
>
Thanks for the reply. This is good to know. But I don't think it
solved my issue with being able to scroll a view without a scrollbar.
See my reply to my own post.
| |
| lopemanc@swbell.net 2007-03-15, 7:16 pm |
| On Mar 4, 4:16 pm, lopem...@swbell.net wrote:
> Hi guys,
>
> Quick question. Code just not clicking.
>
> Need to sync scrolling of 2 subcanvases. Preferably one with a scroll
> bar and one without. Looked at SlaveScrollWrapper and set
> scrollOffsetHolder:. But must be messing up somewhere. Probally
> during the postBuildWith: hook. Anyway, any help is greatly
> appreciated.
>
> Thanks,
>
> Chris
For future reference of others I am posting my solution to my issue.
I actually tried to post this a few days back but it still has not
showed up so I am reposting.
First thing I did was use the canvas editors to add the scroll bars to
my slave canvas. I really don't want these but putting them there
builds the window with all the objects needed to scroll. Now in
postBuildWith: we will get rid of the scroll bars in the slave canvas.
like so:
headerScroller := (self builder componentAt: #planHeader) decorator.
headerScroller noHorizontalScrollBar.
Also here we will hook a dependency so that we are notified anytime
the master canvas changes scroll position.
scroller := (self builder componentAt: #masterCanvas) decorator
scrollerComponent scrollOffsetHolder.
scroller expressInterestIn: #value for: self sendBack:
#scrollChanged.
Now let's write scrollChanged.
scrollChanged
| headerScroller myScroller |
headerScroller := (self builder componentAt: #planHeader) decorator
scrollerComponent scrollOffsetHolder.
myScroller := (self builder componentAt: #masterCanvas) decorator
scrollerComponent scrollOffsetHolder.
headerScroller value: myScroller value x @ headerScroller value y
Basically we are picking up the scroll offset from the master and
shoving it in the slave. Here I am only interested in the horizontal
scrolling.
Enjoy,
Chris
| |
| maarten 2007-03-15, 7:16 pm |
| Doesn't look so bad I'll try that some later.
Now do you know how to get the scroll bar from right to left ?
@+Maarten,
lopemanc@swbell.net a écrit :
> On Mar 4, 4:16 pm, lopem...@swbell.net wrote:
>
>
>
> For future reference of others I am posting my solution to my issue.
> I actually tried to post this a few days back but it still has not
> showed up so I am reposting.
>
> First thing I did was use the canvas editors to add the scroll bars to
> my slave canvas. I really don't want these but putting them there
> builds the window with all the objects needed to scroll. Now in
> postBuildWith: we will get rid of the scroll bars in the slave canvas.
> like so:
>
> headerScroller := (self builder componentAt: #planHeader) decorator.
> headerScroller noHorizontalScrollBar.
>
> Also here we will hook a dependency so that we are notified anytime
> the master canvas changes scroll position.
>
> scroller := (self builder componentAt: #masterCanvas) decorator
> scrollerComponent scrollOffsetHolder.
> scroller expressInterestIn: #value for: self sendBack:
> #scrollChanged.
>
> Now let's write scrollChanged.
>
> scrollChanged
>
> | headerScroller myScroller |
>
> headerScroller := (self builder componentAt: #planHeader) decorator
> scrollerComponent scrollOffsetHolder.
> myScroller := (self builder componentAt: #masterCanvas) decorator
> scrollerComponent scrollOffsetHolder.
> headerScroller value: myScroller value x @ headerScroller value y
>
> Basically we are picking up the scroll offset from the master and
> shoving it in the slave. Here I am only interested in the horizontal
> scrolling.
>
>
> Enjoy,
>
> Chris
>
>
| |
| lopemanc@swbell.net 2007-03-16, 8:30 am |
| On Mar 15, 3:31 pm, maarten <maarten.most...@wanadoo.fr> wrote:[color=darkred]
> Doesn't look so bad I'll try that some later.
>
> Now do you know how to get the scroll bar from right to left ?
>
> @+Maarten,
>
> lopem...@swbell.net a =E9crit :
>
>
>
>
>
>
>
>
>
r=2E[color=darkred]
>
>
>
>
>
>
>
>
>
If I understand your question correctly, it is built in. Just do
something like the following in your postBuildWith:.
(self builder componentAt: #sbcCanvas) decorator edgeDecorationPolicy
verticalScrollBarOnRight: false.
|
|
|
|
|