Copy link to clipboard
Copied
I have obtained the IControlView of the panel or dialog, and then called the MoveTo function, but it doesn't change the window's position. For the panel, I obtained the IWidgetParent interface through IControlView, and then got the IWindow interface by calling:
InterfacePtr<IWidgetParent> myParent(panelControw, UseDefaultIID());
InterfacePtr<IWindow> iWindow((IWindow*)myParent->QueryParentFor(IWindow::kDefaultIID));For dialogs, I created a new dialog using:
IDialog* dialog = dialogMgr->CreateNewDialog(dialogSpec, IDialog::kMovableModal);Then I got the IWindow interface through:
InterfacePtr<IWindow> iWindow(dialog, UseDefaultIID());Afterwards, I called the SetPosition function of the IWindow interface, but still couldn’t change the window's position. Has anyone encountered this issue before? Any guidance or advice from more experienced developers would be greatly appreciated. Thank you.
Get the panel via IDialog::GetDialogPanel, e.g. for Resize()
For moving, I used IDialog::SetDialogPositioningAlgorithm(IDialog::kAutoCenter);
If you need non-center, dive into the header comments.
I leave palette panel positions to the user, as they are determined by the holding palettes anyway.
You can arrange these palettes and groups e.g. docked to some screen margin.
For a large set of panels I added a menu to some Window submenu to collect them into a new palette with tab group, stacked etc. r
...Copy link to clipboard
Copied
Get the panel via IDialog::GetDialogPanel, e.g. for Resize()
For moving, I used IDialog::SetDialogPositioningAlgorithm(IDialog::kAutoCenter);
If you need non-center, dive into the header comments.
I leave palette panel positions to the user, as they are determined by the holding palettes anyway.
You can arrange these palettes and groups e.g. docked to some screen margin.
For a large set of panels I added a menu to some Window submenu to collect them into a new palette with tab group, stacked etc. rather than the random initial group. Also doing that from an Initializer for startup once after installation.
Not sure about actual position, but if you find nothing better have a look at the top of PaletteRef.h and GetOWLControl()
Copy link to clipboard
Copied
Thank you, Dirk Becker,I have already found a method. By using the following function, I can set the position of the panel.
PaletteRef paletteref = panelMgr->GetPaletteRefContainingPanel(panel);
PaletteRefUtils::SetPalettePosition(paletteref, 300, 300);
Copy link to clipboard
Copied
I wrote on a tiny laptop where I missed SetPalettePosition, should also have more emphasized that it is all about PaletteRef. Thanks for sharing.
Make also sure before positioning that your palette is not docked by the user.
For your test cases, remember to test both UI scalings - via OS and via InDesign's preferences.
One reason for annoying flicker and costly multiple redraws is when UI scaling bumps you to fractional pixels for position or size, then somewhere deep inside a resize tries to get you back to full pixels by another turn of size or move.
This is also relevant when you overload IControlView::ConstrainDimensions().
Find more inspiration, events, and resources on the new Adobe Community
Explore Now