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