Field of Card of Stack
Francis Nugent Dixon
effendi at wanadoo.fr
Sun Dec 9 17:36:26 EST 2007
Hi from Paris,
I include the following field/button/script mechanism
in ALL my stacks as I create them. I can display a list
of fields in any card of the stack, at any time. It helps
me to ensure that I don't have two fields with the same
name (so easy to do with the "duplicate" function), and
also that I strictly adhere to my own field naming system.
It doesn't solve all problems, but helps for clean living.
Create a large field called "MySystemFieldList" in card 1
Create a button (label Showfields) on ALL cards, with this
script :
on mouseUp
--
-- ShowField/HideField - V01 - 2006/03/31 - 16:00 - Creation
--
-- This script displays the field names declared on
-- this card in a field "MySystemFieldList". This field
-- is filled and shown when the button is clicked, and
-- is hidden when the button is clicked again.
--
-- This script functions from any card in the stack, but
-- always displays the data in a field in Card 1.
--
if the label of me = "ShowFields" then
put empty into field MySystemFieldList
set the lockscreen to true
put the number of fields in this card into LVFieldCount
if LVFieldCount = 0 then
put " No Fields declared" into line 2 of field
MySystemFieldList
show field MySystemFieldList
set the lockscreen to false
exit mouseUp
end if
set numberFormat to 00
put 0 into LVLineCount
repeat LVFieldCount -- I know there are quicker ways to do
this !!! So What !!
add 1 to LVLineCount
put LVLineCount & " - " & the name of field LVLineCount into
line LVLineCount of LVSystemFieldList
end repeat
go to card 1
set the label of me to "HideFields"
put LVSystemFieldList into field MySystemFieldList
show field MySystemFieldList
exit mouseUp
end if
if the label of me = "HideFields" then
set the label of button FieldList to "ShowFields"
hide field MySystemFieldList
end if
end mouseUp
I also use a similar mechanism for variables, buttons and
groups, but this is another story. Of course, the buttons
which run these mechanisms are always present in my stacks,
but are shown (by an invisible button) during development or
stack update, but are hidden when delivered to the users.
-Francis
More information about the use-livecode
mailing list