Resizable CPCollectionViewItem?

19 views
Skip to first unread message

samdev

unread,
Jan 4, 2010, 6:26:30 PM1/4/10
to objec...@googlegroups.com
I want to have a changing list of text messages displayed one after another (say, like in Adium).

I guess CPCollectionView may be a good candidate for this. So, now I have messages displayed in one column one after another.

Nevertheless the collection view may change it's width as window can be resized by user. Is there any way to make CPCollectionViewItem, displayed inside the CPCollectionView, to adjust dynamically its width?

Example is below.

Before resize: http://twitpic.com/wp1jx
After resize: http://twitpic.com/wp1qe

As you see CollectionView did change but Item inside still has the same width.

Justin

unread,
Jan 4, 2010, 7:09:14 PM1/4/10
to Cappuccino & Objective-J
I haven't been successful with setting a setAutoresizingMask on my
listItem view. I'll look further into this later today and let you
know.

cheers,
Justin

Chandler Kent

unread,
Jan 4, 2010, 7:25:46 PM1/4/10
to Cappuccino & Objective-J
Look at setMinSize: and setMaxSize: on CPCollectionView.

Joel Norvell

unread,
Jan 4, 2010, 7:37:57 PM1/4/10
to Cappuccino & Objective-J
samdev,

It might be helpful for you to look at the excellent Flickr Photo
Demo, which implements dynamic resizing behavior of a
CPCollectionView.

http://cappuccino.org/learn/demos/

Sincerely,
Joel

Justin

unread,
Jan 4, 2010, 8:04:14 PM1/4/10
to Cappuccino & Objective-J
the flickr demo doesn't show the resizing of collection view item
view's (the images in the demo).

cheers,
Justin

Ross Boucher

unread,
Jan 4, 2010, 8:18:04 PM1/4/10
to objec...@googlegroups.com
Yes it does. Slide the slider that's in the toolbar and watch them change size.

-Ross

> --
>
> You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
> To post to this group, send email to objec...@googlegroups.com.
> To unsubscribe from this group, send email to objectivej+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/objectivej?hl=en.
>
>

KSamdev

unread,
Jan 4, 2010, 8:44:12 PM1/4/10
to objec...@googlegroups.com
It does not solve my issue. I do not want to set min size to, say,
(10,10) and max to (10000,10000). It is bad style.

Sincerely, Samvel.

KSamdev

unread,
Jan 4, 2010, 8:46:53 PM1/4/10
to objec...@googlegroups.com
I agree. Flickr demo is a great example for a collection view with
images that should not get resized. I have Text Field.

Sincerely, Samvel.

Ross Boucher

unread,
Jan 4, 2010, 8:47:05 PM1/4/10
to objec...@googlegroups.com
Well, bad style aside (and I don't think it really is), that's not the only way to use these properties to your advantage. Once again, the Flickr tutorial shows how you might accomplish updating them dynamically.

-Ross

KSamdev

unread,
Jan 4, 2010, 8:49:13 PM1/4/10
to objec...@googlegroups.com
Size can be changed with slider but I want Items to dynamically change
it's width when content view gets resized because I have Items
arranges in one column.

Sincerely, Samvel.

samdev

unread,
Jan 4, 2010, 9:08:37 PM1/4/10
to objec...@googlegroups.com
Ok, I reviewed the Flickr demo code once again. Here is what happens:

Once slider gets new value some operation is called that resizes CollectionViewItems by setting new Min and Max size. Resize is done manually.

In overall, in my application (displaying a simple list inside the window of some text messages) I could track myself any superview resize action (say, with delegate) and adjust size of CollectionView by calling setMinItemSize and setMaxItemSize in exactly the same way it is done in Flickr demo above.

Although, I do not think this is the way it should be done. I home Cappuccino adjusts Height and Width automatically if I ask it to do so. Resize should be done once I apply Autoresizing Mask to Items in the same way as it is done for say CPTextField or any other Subclass of CPView.

Unfortunately it does not seem to work the same way for CollectionView Items.

Thomas Reynolds

unread,
Jan 15, 2010, 2:33:08 AM1/15/10
to Cappuccino & Objective-J
I'm trying to accomplish the same thing. Though in my app, it is a
list of comments.

Basically, it seems that word-wrapping is accomplished through CSS
rather than resizing the CPTextField to accommodate the new lines.
Because of this, there doesn't seem to be any way for my newly
enlarged CPTextField to tell it's containing CPCollectionView (or
CPOutlineView) that it's height is... whatever it's reflowed, word-
wrapped height is.

Any thoughts? Am I going down the wrong road?

-Thomas

On Jan 4, 6:08 pm, samdev <ksam...@gmail.com> wrote:
> Ok, I reviewed the Flickr demo code once again. Here is what happens:
>
> Once slider gets new value some operation is called that resizes CollectionViewItems by setting new Min and Max size. Resize is done manually.
>
> In overall, in my application (displaying a simple list inside the window of some text messages) I could track myself any superview resize action (say, with delegate) and adjust size of CollectionView by calling setMinItemSize and setMaxItemSize in exactly the same way it is done in Flickr demo above.
>
> Although, I do not think this is the way it should be done. I home Cappuccino adjusts Height and Width automatically if I ask it to do so. Resize should be done once I apply Autoresizing Mask to Items in the same way as it is done for say CPTextField or any other Subclass of CPView.
>
> Unfortunately it does not seem to work the same way for CollectionView Items.
>
> On Jan 4, 2010, at 7:47 PM, Ross Boucher wrote:
>
> > Well, bad style aside (and I don't think it really is), that's not the only way to use these properties to your advantage. Once again, the Flickr tutorial shows how you might accomplish updating them dynamically.
>
> > -Ross
>
> > On Jan 4, 2010, at 8:44 PM, KSamdev wrote:
>
> >> It does not solve my issue. I do not want to set min size to, say,  
> >> (10,10) and max to (10000,10000). It is bad style.
>
> >> Sincerely, Samvel.
>

> >>> For more options, visit this group athttp://groups.google.com/group/objectivej?hl=en
> >>> .
>
> >> --
>
> >> You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
> >> To post to this group, send email to objec...@googlegroups.com.
> >> To unsubscribe from this group, send email to objectivej+...@googlegroups.com.

> >> For more options, visit this group athttp://groups.google.com/group/objectivej?hl=en.

Justin

unread,
Jan 15, 2010, 4:06:43 AM1/15/10
to Cappuccino & Objective-J
You'll need to create your own view for this. I do this in the
twitter demo (code here: http://github.com/justinfreitag/Cappuccino-Twitter-Client).
Look at the TimelineView and TimelineViewItem classes.

cheers,
Justin

Thomas Reynolds

unread,
Jan 15, 2010, 4:41:52 AM1/15/10
to objec...@googlegroups.com
Thanks, looks like the secret sauce is:


-Thomas
Reply all
Reply to author
Forward
0 new messages