Re: Repetition Question...
Re: Repetition Question...
- Subject: Re: Repetition Question...
- From: Jonathan Rochkind <email@hidden>
- Date: Tue, 30 Mar 2004 14:40:38 -0600
At 2:13 PM -0600 3/30/04, James Cicenia wrote:
Hello all -
I have created a worepetition and needed to have buttons on the
side that would reorder the list. i.e., move item up or down.
Now I have the display of the buttons working great using the
index in WORepetition. The question is how can I use index to
find the item either above or below the one I am changing so that
I can also change that items sequence number?
Well, assuming you have the list bound to an array, wouldn't simply this work?
int index; //assume exists
NSArray listArray; //assume exists
Object previous = listArray.objectAtIndex( index - 1);
Object next = listArray.objectAtIndex( index + 1);
Make sure that the WORepetition 'index' starts at 0---NSArray index
does. If WORepetition starts at '1' (I forget which it does), then
adjust accordingly. Make sure you aren't going out of bounds on your
objectAtIndex (don't ask for objectAtIndex( -1 ), and don't ask for
an index beyond the bounds of the array.
Sometimes changing the contnet of the 'list' binding to a
WORepetition can have undesirable results, but I think you should be
okay here.
PS: I wouldn't think you'd need to use the 'index' binding in
WORepetition to display the buttons! But you do need it to implement
this functionality, yes.
--Jonathan
-James Cicenia
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.