copy field to stack of unknown name
Bob Hartley
rev at armbase.com
Sat Feb 12 11:09:05 EST 2005
At 15:31 12/02/2005, you wrote:
>Hi Bob,
Hi Klaus
No luck with this. I used the method of Richard Gaskin's employee database
to ask the user for a filename before starting. I had this working the old
fashioned way but I think the pre-save is more elegant. Anyway I used this
for them to make a new file.....
on doFileNew
ask file "Name new database file:" with "MyDatabase.abd"
if it is empty then exit to top
put it into tFileName
if char -4 to -1 of tFileName is not ".abd" then put ".abd" after tFileName
set the itemDelimiter to "/"
put last item of tFileName into tStackName
set the visible of stack "Master Database" to false
clone stack "Master database"
Err the result
set the name of stack it to tStackName
set the title of stack tStackName to (char 1 to -5 of tStackName)
--set the minWidth of stack tStackName to 500
--set the minHeight of stack tStackName to 250
set the fileName of stack tStackName to tFileName
-- "tFileName" is the full pathname of the file the user named earlier.
Err the result
set the visible of stack "Master Database" to true
put the stackFileType into tSaveStackFileType
set the stackFileType to "RevoABD_"
save stack tStackName
Err the result
set the stackFileType to tSaveStackFileType
show stack tStackName
toplevel stack tStackName
end doFileNew
Now when I use a buton with the script
on mouseUp
copy field "TextField" of stack "Armbase Database Designer" to card 1 of
stack tFileName
--or use tStackName
end mouseUp
then there is an error
executing at 4:01:57 PM
Type Chunk: can't find stack
Object Add Field
Line copy field "TextField" of stack "Armbase Database Designer" to card
1 of stack tFileName
Hint button id 1052 of card id 1002 of stack "Armbase Database Designer"
If I use tStackName I get the same
executing at 4:03:54 PM
Type Chunk: can't find stack
Object Add Field
Line copy field "TextField" of stack "Armbase Database Designer" to card
1 of stack tStackName
Hint button id 1052 of card id 1002 of stack "Armbase Database Designer"
But if I use
on mouseUp
copy field "TextField" of stack "Armbase Database Designer" to card 1 of
stack "MyDatabase.abd"
end mouseUp
It works, however I don't know if the target stack is always going to be
MyDatabase.abd
If I use
tStackName.abd I get the same error
Any help would be great
Cheers
Bob; Sunny Scotland
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 10/02/2005
More information about the use-livecode
mailing list