Page 1 of 1
Delete group error message
Posted: Wed Apr 02, 2014 4:29 am
by CenturyMan1979
Hey All,
Updating a project from 5.5.4 to 6.6 and I seem to be having some issue with some code where I am deleting a group that is inside another group. The line of code I was using in 5.5.4 was,
Code: Select all
//tID = the id number of the group
delete group id tID
Now when I am trying this same bit of code in 6.6 the program hits this line and spits out the following error,
Code: Select all
group "soGroup": execution error at line n/a (Object: stack locked, or object's script is executing)
Anyone else come across this issue when moving to the community edition? Also the code would seem to work when I executed it from the message window.
Re: Delete group error message
Posted: Wed Apr 02, 2014 1:52 pm
by Klaus
Hi CenturyMan1979,
where exactly is the part that tries to delete the group?
In a stack/card or other script? And how and where do you call it?
Best
Klaus
Re: Delete group error message
Posted: Wed Apr 02, 2014 2:55 pm
by CenturyMan1979
Here is the structure of my stack
- main_stack
- main_group
- thumbnail_display_group
- thumbnail_group (Repetitive thumbnail component for displaying thumbnails)
- right_click_popup_menu
So when I right click on a thumbnail_group the following code is executed,
Code: Select all
# Mouse Right Click
#=====================================================================
on mouseUp pMouseButton
if (pMouseButton = 3) then
put "Delete Module" into tPopMenuContent
set the text of button "right_click_popup_menu" to tPopMenuContent
popup button "right_click_popup_menu"
end if
end mouseUp
Then when you select "Delete Module" from right_click_popup_menu then it will do this,
Code: Select all
on menuPick pMenuItem
switch pMenuItem
case "Delete Module"
dispatch "deleteModule" -- deleteModule method is located in main_group
break
default
pass menuPick pMenuItem
end switch
end menuPick
Then here is the method from main_group,
Code: Select all
on deleteModule
dispatch "deleteModule" to group "thumbnail_display_group"
end deleteModule
And here is the code (up to the error) in thumbnail_group, also to note that when you left click on a thumbnail it will add its group id to a list called cSelectedIndexList. This way I could delete multiple thumbnail_groups at one time.
Code: Select all
on deleteModule
put the cSelectedIndexList of me into tSelectedIndexList -- List of group ids that have been selected from the thumbnail_display_group
put the number of lines of (the keys of tSelectedIndexList) into tLoop
if (tLoop = 0) then exit deleteModule
lock screen
put the cTimelineContent of me into tCurrTimelineContent
repeat with n = 1 to tLoop
put tSelectedIndexList[n] into tID
put the cModuleCount of group id tID into tIndex // Getting the position of the thumbnail_group in the thumbnail_display_group from the cModuleCount variable
delete group id tID // <---- Here is where the error gets triggered
delete variable tCurrTimelineContent[tIndex]
end repeat
Re: Delete group error message
Posted: Wed Apr 02, 2014 4:11 pm
by CenturyMan1979
After that huge response I ended up finding the issue. I changed the code in main group from
Code: Select all
on deleteModule
dispatch "deleteModule" to group "thumbnail_display_group"
end deleteModule
to
Code: Select all
on deleteModule
send "deleteModule" to group "thumbnail_display_group" in 0 millisecond
end deleteModule
Not sure why it worked in 5.5.4 and now does not work. Must of been a bug that got fixed.
Re: Delete group error message
Posted: Wed Apr 02, 2014 8:10 pm
by Klaus
Glad you could solve it!