Skip to content

Instantly share code, notes, and snippets.

@958
Created May 6, 2024 09:49
Show Gist options
  • Save 958/527ab4b52d090fbfe24924a02a960190 to your computer and use it in GitHub Desktop.
Save 958/527ab4b52d090fbfe24924a02a960190 to your computer and use it in GitHub Desktop.
tablacus explorer move current tab to selected tabgroup
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) {
const TCs = await te.Ctrls(CTRL_TC, false, window.chrome);
for (let i = 0; i < await TCs.length; i++) {
if (await TCs[i].Data.Group == nVerb) {
const TC = TCs[i];
const TC1 = await te.Ctrl(CTRL_TC);
const index = await TC.Count;
await TC1.Move(await TC1.SelectedIndex, index, TC);
TC.SelectedIndex = index;
Addons.Tabgroups.Change(nVerb);
break;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment