diff options
| author | Markus Mittendrein <git@maxmitti.tk> | 2018-12-08 14:56:20 +0100 |
|---|---|---|
| committer | Markus Mittendrein <git@maxmitti.tk> | 2018-12-08 14:56:20 +0100 |
| commit | 63ae14a44eda45ba50994d8ca7b89dd6ce15ad32 (patch) | |
| tree | 226a28f102454648afa66697e61c27869ec5e4f1 /Script.c | |
| parent | 2961e47f954d3ac209ce33524202879f1e8f683d (diff) | |
| download | DTMenu.c4d-63ae14a44eda45ba50994d8ca7b89dd6ce15ad32.tar.gz DTMenu.c4d-63ae14a44eda45ba50994d8ca7b89dd6ce15ad32.zip | |
Fix bugs when using Menu_Entry_Icon and fix menus that shrink while the selection is on the last entry
Diffstat (limited to 'Script.c')
| -rw-r--r-- | Script.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -242,10 +242,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; } @@ -669,7 +670,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]; @@ -677,7 +679,10 @@ func AddEntries() { deleteIcon = icon[0]; } - iconID = GetID(icon[0]); + if(!iconID) + { + iconID = GetID(icon[0]); + } } } else @@ -1072,11 +1077,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; |
