Selection Zoom without Context Menu

Everything DG Kernel: Technical discussions and issues
Post Reply
evan
Posts: 1
Joined: Wed Feb 12, 2025 2:53 pm

Selection Zoom without Context Menu

Post by evan »

Hello,

Is it possible to call selection zoom without using the context menu? I am trying to zoom using a button. I am running version 7.2 build 5545.

I can find the option in the context menu using IMenu_KC and IMenuItem_KC but using IMenuItem_KC.execute does nothing. (IMenuItem_KC.GetText returns "Selection Zoom" so I believe it is the right index) Below is example code.

Code: Select all

Dim MenuItem As IMenuItem_KC
Dim Menu As IMenu_KC, MenuAdvanced As IMenu_KC

Set Menu = MyView3D
Set MenuAdvanced = Menu.GetSubMenu(8)         ' advanced submenu
Set MenuItem = MenuAdvanced.GetItemAt(3)      ' zoom selection
Debug.Print MenuItem.GetText                  ' returns "Selection Zoom"
MenuItem.execute

Thanks,
Evan
Mike Zubovic
Posts: 6
Joined: Mon Jul 15, 2024 5:20 am

Re: Selection Zoom without Context Menu

Post by Mike Zubovic »

Hello Evan

I have reproduced this. It seems to be a bug. We need to do more checks to be sure. The call is kind of generic and got lost during code splits for various types of controls. We are looking into this.

Thanks for reporting.

Mike Zubovic
Developer
DInsight
Mike Zubovic
Posts: 6
Joined: Mon Jul 15, 2024 5:20 am

Re: Selection Zoom without Context Menu

Post by Mike Zubovic »

We just have posted a fix in update 5559.

We have tested it in a modified copy of C++ Light sample:

Code: Select all

void CLightDlg::OnButColor() 
{
	IMenu_KC* iMenu = nullptr;
	IMenu_KC* iMenuAdvanced = nullptr;
	IView_DGPtr iView = m_DGKern.GetViewDG();
	iView->QueryInterface(IID_IMenu_KC, (void**)&iMenu);
	iMenu->GetSubMenu(8, &iMenuAdvanced);         // advanced submenu

	IMenuItem_KC* iMenuItemSelectionZoom = nullptr;
	iMenuAdvanced->GetItemAt(3, &iMenuItemSelectionZoom);      // zoom selection

	iMenuItemSelectionZoom->Execute();
}
For other readers:
We do not have currently a _DG version of IMenu_KC. So, it is not available in .NET controls, unfortunately. We have added this to the to-do list for v7.3.

Regards
Post Reply