1. Make newSFP a global variable
2. Pass newSFP as a parameter to the function that deletes the folder.
The first option is easier to implement, although a little quirky in xtalk, but is best avoided in general because of scope issues.
The second one requires a bit of refactoring of your code, so it's more involved, but is a better general-purpose solution.
one possible Solution 1:
put this line into the mouseUp handlers of both buttons:
Code: Select all
global newSFP
in button "btnDelete"
add this line before the "delete Folder" line:
Code: Select all
put field "Field2" into newSFP
in the card script:
Code: Select all
local sNewSFP -- this is now a script-local variable, available to all card script handlers
command deleteThisFolder
delete folder sNewSFP
end deleteThisFolder
command storeThisFolder pFolder
put pFolder into sNewSFP
end storeThisFolder
Code: Select all
deleteThisFolder
put this line after "put newSFP into field Field2":
Code: Select all
storeThisFolder newSFP