filter and reorder a list via field on other stack
Sivakatirswami
katir at hindu.org
Fri May 13 01:13:39 EDT 2005
Well, if there is any textual relationship between the actual content
of the line on the list and the card itself, then I have (ever since
hypercard and supercard days) *always* named my cards programatically
and then using the clicktext function on the index listings:
go to card (the clicktext) # in the index list field
or
go to card (word 1 of the clicktext)
or whatever...it will always work regardless of a) sort order of the
list b) sort order of cards in the stack...
the trick is to have the cards get their name assigned the name you
want that will relate to the index list, at the time those card are
created... and then dynamically generate indices from the card names...
there are caveats though... I can't remember them all.. I think you
don't want to start a card name with a number...?? I typically have a
short field on every card in my PIM
subject:
and a close card handler: "set the name of this card to fld "
Here is how I hyper link and generated cards from selected text and
auto add to an index:
on makeLink
if the selection is empty then
answer "You need to select something." with "OK"
exit makeLink
else
put the selection into tNewCard
set the textstyle of the selection to link
open stack "Linked Entries"
if exists (card tNewCard) then
exit makeLink
else
new card
put tNewCard into fld "Subject"
set the name of this card to fld "subject"
send upDateIndex to stack "linked Entries"
end if
end if
end makeLink
on upDateIndex
repeat with x = 1 to the number of cards of this stack
put short name of cd x & cr after tIndex
end repeat
sort tIndex
put tIndex into fld "index"
choose browse tool
end upDateIndex
And here is a dynamically built index put into a button, but you could
adopt this to create the index into a field, incredibly simple
really....
Pull down menu button:
on mousedown
repeat with x =1 to the number of cards in this stack
put the short name of card x & cr after jai
end repeat
put jai into me
end mousedown
on menupick which
go to card which
end menupick
And don't forget one of those xTalk gotchas:
"the short name" gives you a simple string, but you never set the short
name you just "set the name"
set the short name of this card to "Go Figure"
gives an error. On day they should fix that...
I've had stacks with thousands of cards, all named and going to a card
name is very fast.
skts
On May 11, 2005, at 8:27 AM, rev at armbase.com wrote:
> Also, i want the list to be reordered in some way, however, this
> upsets the
> relationship of the cards to the list items. I remember that there was
> some
> trict to keep the list item associated with the cards by adding the
> card number
> and tabbing it out of the field boundaries....
>
> Anyone know the standard trick?
More information about the use-livecode
mailing list