Skip to content

Instantly share code, notes, and snippets.

@958
Created March 28, 2024 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 958/5f581dbaa94e4e088bf6da1b5e529166 to your computer and use it in GitHub Desktop.
Save 958/5f581dbaa94e4e088bf6da1b5e529166 to your computer and use it in GitHub Desktop.
tablacus explorer popup tabgroup menu
const tabs = [];
const len = await GetLength(await te.Data.Tabgroups.Data);
for (let i = 0; i < len; i++) {
const name = await te.Data.Tabgroups.Data[i].Name;
tabs.push({ index: i, name: name});
}
let hMenu = await api.CreatePopupMenu();
for (let i = tabs.length; i--;) {
let uFlags = MF_STRING;
if ((await te.Data.Tabgroups.Click - 1) == i) {
uFlags |= MF_CHECKED;
}
await api.InsertMenu(hMenu, 0, MF_BYPOSITION | uFlags, i + 1, (i+1) + ". " + tabs[i].name);
}
const x = pt.x;
const y = pt.y;
const nVerb = await api.TrackPopupMenuEx(hMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, x, y, ui_.hwnd, null, null);
api.DestroyMenu(hMenu);
if (nVerb > 0) {
Addons.Tabgroups.Change(nVerb);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment