2.2.4.32.24 OriginObject::GetMenuID

Description

Given a selection type, this command depending upon the supplied screen co-ordinates, will Supply a the resource ID and popup position of the most suitable popup menu

Syntax

int GetMenuID( int nSeletionType, int xCur, int yCur, int & npos )

Parameters

nSeletionType
[input] The type of selection
xCur
[input] the screen X value
yCur
[input] the screen Y value
npos
[output] the popup index suitable under the circumstance

Return

The resource ID

Examples

EX1

#include <Control.h> 
#include <OC_Res.h>
void OriginObject_GetMenuID_Ex1(Menu* pmenu)
{
    Worksheet wks = Project.ActiveLayer();
    int c1, c2, r1, r2;
    int nPos = 0;
    int nSel = wks.GetSelection(c1, c2, r1, r2);
    HINSTANCE hInstOutil = GetModuleHandle(MODULE_OU);
    int nId = wks.GetMenuID(nSel, 0, 0, nPos);
    if(pmenu->Load(hInstOutil, nId, nPos))
    {
        HWND hMenu = pmenu->GetSafeHmenu();
        if(hMenu)
            wks.AddInternalMenu(hMenu, nId, 1);
        
        int nCmd = pmenu->TrackPopupResMenu(0,  0, 0, GetWindow());    //Screen co-ordinates
        wks.GetPage().ProcessCommand(nCmd);
    }
}

Remark

See Also

Header to Include

origin.h