summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2018-12-08 14:54:55 +0100
committerMarkus Mittendrein <git@maxmitti.tk>2018-12-08 14:54:55 +0100
commit39d81696dd8b0d8fd861ee4dffcff44e6e79b55e (patch)
tree1e7a70379f63b1637ae80ca14fdba2399570183d
parente8cf85636f2a4fcf1cc41fc5f56f9b90bbb013ec (diff)
downloadDTMenuDebug.c4d-39d81696dd8b0d8fd861ee4dffcff44e6e79b55e.tar.gz
DTMenuDebug.c4d-39d81696dd8b0d8fd861ee4dffcff44e6e79b55e.zip
Fix bugs when using Menu_Entry_Icon and fix menus that shrink while the selection is on the last entry
-rw-r--r--Script.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/Script.c b/Script.c
index 16d6699..46f289b 100644
--- a/Script.c
+++ b/Script.c
@@ -252,10 +252,11 @@ func Create(array cSettings, array cEntries)
// update submenu columns if necessary and build title
for(var i = 0; i < GetLength(currentColumnSelections); ++i)
{
- // TODO: cascade? then remove the columnSelection == -1 check
+ // TODO: cascade? then remove the columnSelection == -1 check; and check if shrinking menus still work correctly
var columnSelection = currentColumnSelections[i];
- if((columnSelection == -1) || !columnEntries[i])
+ if((columnSelection == -1) || !columnEntries[i] || columnSelection >= GetLength(columnEntries[i]))
{
+ currentColumnSelections[i] = GetLength(columnEntries[i]) - 1;
break;
}
@@ -701,7 +702,8 @@ func AddEntries()
entry[DT_Menu_Entry_XPar1] = icon[1];
}
}
- else if(GetType(icon[0]) == C4V_C4Object)
+
+ if(GetType(icon[0]) == C4V_C4Object)
{
entry[DT_Menu_Entry_Extra] |= C4MN_Add_ImgObject;
entry[DT_Menu_Entry_XPar1] = icon[0];
@@ -709,7 +711,10 @@ func AddEntries()
{
deleteIcon = icon[0];
}
- iconID = GetID(icon[0]);
+ if(!iconID)
+ {
+ iconID = GetID(icon[0]);
+ }
}
}
else
@@ -1104,11 +1109,15 @@ func Refresh(array selection, bool delayed)
refreshing = oldRefreshing;
var column = BoundBy(selection[1], 0, columnCount);
selection = selection[0];
- SelectEntry(BoundBy(selection, 0, GetLength(columnEntries[column]) - 1), column);
- if(settings[DT_Menu_Settings_InstantDescription])
+ if(GetLength(columnEntries[column]) > 0)
{
- ShowInstantDescription(columnEntries[currentColumn][selection]);
+ SelectEntry(BoundBy(selection, 0, GetLength(columnEntries[column]) - 1), column);
+
+ if(settings[DT_Menu_Settings_InstantDescription])
+ {
+ ShowInstantDescription(columnEntries[currentColumn][selection]);
+ }
}
noSelectionCallbacks = oldNoSelectionCallbacks;