Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

multiple tab with shared list?

38 views
Skip to first unread message

jndcu...@gmail.com

unread,
Dec 31, 2012, 5:23:25 PM12/31/12
to
hi all,

i'm developing an application which uses a tabview with an embedded editable listpresenter. the model is a collection which though structurally homogeneous maps to different tabs depending on instance content. i have this working now but what i would've liked to have done would be to have one listpresenter which would be shared by the tabs. i realize i would have to manage the list content depending on the tab selected.

is there a way to do this in d6? using the view composer? if this has been discussed before, just point me to it. a search of the archives didn't seem to address this.

thanks in advance,

john

Chris Uppal

unread,
Jan 2, 2013, 10:19:33 AM1/2/13
to
jndcu...@gmail.com wrote:

> what i would've liked to have done
> would be to have one listpresenter which would be shared by the tabs.

I think that you can do it as follows (I assume this still works in D6, I've
only had to do it in D5 so far):

You use a ListPresenter.'Tab View' (/not/ a Presenter.'Card container') to
display the list of tabs. Set the Presenter to be a normal ListPresenter in
#createComponents, set its model to be (say) a list of String names of the tabs
(or rather, a ListModel on a list of Stings), and then listen for its
#selectionChanged. When the selection is changed, you'll have to swap in the
new contents for your (fixed) EditableListView (remembering to do something
sensible with any on-going edits ;-)

From memory, it's a little tricky to get this looking quite right. What I did
was use FramingLayout for the enclosing container. Added my "contents" view as
the first sub-view, and made it cover all but the top 25 pixels of its parent.
Added a ListPresenter.'Tab view' as the /second/ sub-view of the container, and
made it cover the entirety of the parent. The end result is that the TabView
"thinks" it covers the entire parent, but most of its area is actually obscured
by the "contents" view. That looks OK provided you don't have enough tabs to
"wrap" onto more than one line.

If you do need to wrap, then you have two alternatives that I know of:

One is to study the implementation of CardView and work out how in Hell OA have
managed to make that (compound) View manage its tabs so that they wrap
correctly. I have never managed it, but you might, and I would welcome
suggestions ;-)

The other is to send
... baseStyleMask: TCS_MULTILINE set: false
to the ListPresenter's view (the TabView) in your #onViewAvailable or
#onViewOpened, to turn off wrapping in the strip of tabs. Gross, but that's
the best I could come up with for my application :-(

Good luck...

(And Happy 2013 to everybody)

-- chris


0 new messages