copy field to stack of unknown name
Sarah Reichelt
sarahr at genesearch.com.au
Sun Feb 13 22:02:16 EST 2005
Hi Bob,
I think you are on the right track, but the stack name (or stack file
name) needs to be a global or custom property if scripts in other
objects are going to access it.
Cheers,
Sarah
On 13/02/2005, at 2:04 AM, Bob Hartley wrote:
> 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
More information about the use-livecode
mailing list