Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 825bad0

Browse files
committed
[Bug 20133] Ensure cloning cards or stacks from the PB works correctly
1 parent 3517fad commit 825bad0

2 files changed

Lines changed: 23 additions & 24 deletions

File tree

Toolset/libraries/revidelibrary.8.livecodescript

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3474,30 +3474,25 @@ on revIDECreateObject pObjectTypeID, pTarget, pLoc
34743474
end revIDECreateObject
34753475

34763476
on revIDECloneObject pLongID
3477-
local tTarget, tLoc, tControlType
3478-
local tCreatedControlID
3479-
3480-
put the loc of pLongID into tLoc
3481-
add 20 to item 1 of tLoc
3482-
add 20 to item 2 of tLoc
3483-
3484-
put revIDECardOfObject(pLongID) into tTarget
3485-
if not exists(tTarget) then return __revIDEError("Cannot create object. Target does not exist:" && tTarget)
3486-
3487-
-- # Set the default stack to the target we're creating the object on
3488-
-- set the defaultstack to the owner of tTarget
3489-
3490-
-- # Create the object
3491-
-- lock screen
3492-
-- lock messages
3493-
--do "clone" && pLongID
3494-
clone pLongID
3495-
put the long ID of the last control into tCreatedControlID
3496-
set the loc of tCreatedControlID to tLoc
3497-
3498-
-- unlock messages
3499-
-- unlock screen
3500-
-- return tCreatedControlID
3477+
if word 1 of pLongID is "card" or word 1 of pLongID is "stack"then
3478+
clone pLongID
3479+
else
3480+
3481+
local tTarget, tLoc, tControlType
3482+
local tCreatedControlID
3483+
3484+
put the loc of pLongID into tLoc
3485+
add 20 to item 1 of tLoc
3486+
add 20 to item 2 of tLoc
3487+
3488+
put revIDECardOfObject(pLongID) into tTarget
3489+
if not exists(tTarget) then return __revIDEError("Cannot create object. Target does not exist:" && tTarget)
3490+
3491+
3492+
clone pLongID
3493+
put the long ID of the last control into tCreatedControlID
3494+
set the loc of tCreatedControlID to tLoc
3495+
end if
35013496
end revIDECloneObject
35023497

35033498
on revIDECloneObjectWithDefaults pLongID

Toolset/palettes/project browser/revprojectbrowserbehavior.livecodescript

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,16 @@ on cloneControls
885885
put pbSelectedObjects() into tControlList
886886

887887
lock screen
888+
local tOldDefaultStack
889+
put the defaultStack into tOldDefaultStack
890+
set the defaultStack to revIDEStackOfObject(line 1 of tControlList)
888891
repeat for each line tControlID in tControlList
889892
revIDECloneObject tControlID
890893
put the result & return after tClonedIDs
891894
end repeat
892895

893896
selectObjects tClonedIDs
897+
set the defaultStack to tOldDefaultStack
894898
unlock screen
895899
end cloneControls
896900

0 commit comments

Comments
 (0)