Why my menu item not display ?

Status
Not open for further replies.

foo

Usenet Archive
Joined
Sep 9, 2001
Messages
144
Reaction score
0
Hi, everyone

I have coded a program 'stf2pkpm.ma'. When I load it by keyin 'mdl load stf2pkpm', it add a menu item 'PKPM Data File' at the bottom of 'File->Export'. But I want this task automatically execute. So, I configure 'Design Application' to 'stf2pkpm'. After I finished my configuration, when MicroStation start or open a new design file, 'stf2pkpm.ma' can be loaded automatically but my menu item not display. Why?

The following is my source code.
Private void addMenuToExport (void)
{
RawItemHdr *mainMenuBarP = NULL;
DItem_PulldownMenuItem newMenuItem;
DItem_PulldownMenu *exportMenuP = NULL;
TextPDM_Item textPDMInfo;
TextPDM_ItemModify textPDMModify;

mainMenuBarP = mdlDialog_menuBarGetCmdWinP ;
if (mainMenuBarP != NULL)
exportMenuP = mdlDialog_menuBarFindMenu (mainMenuBarP, RTYPE_PulldownMenu, PULLDOWNMENUID_SubExport); else return; if (exportMenuP == NULL) return; if (!mdlDialog_menuBarFindItem (&newMenuItem, NULL, mainMenuBarP, RTYPE_PulldownMenu, NULL, 196632L)) return; textPDMModify.submenu = FALSE; textPDMInfo.enabled = ON; textPDMModify.enabled = TRUE; textPDMInfo.mark = NOMARK; textPDMModify.mark = TRUE; textPDMInfo.helpInfo = NOHELP; textPDMModify.helpInfo = FALSE; textPDMModify.helpType = FALSE; textPDMModify.helpTaskIdP = FALSE; textPDMInfo.pulldownItemHookId = NOHOOK; textPDMModify.pulldownItemHookId = FALSE; textPDMInfo.pulldownSearchId = 196632L; textPDMModify.pulldownSearchId = TRUE; textPDMInfo.commandNumber = CMD_STF2PKPM_OPENMAINDLG; textPDMModify.commandNumber = TRUE; textPDMInfo.commandTaskIdP = malloc (10); strcpy (textPDMInfo.commandTaskIdP, "stf2pkpm"); textPDMModify.commandTaskIdP = TRUE; textPDMInfo.unparsedP = malloc (4); strcpy (textPDMInfo.unparsedP, ""); textPDMModify.unparsedP = TRUE; textPDMInfo.labelP = malloc (20); strcpy (textPDMInfo.labelP, "~PKPM Data File"); textPDMModify.labelP = TRUE; textPDMInfo.accelerator = NOACCEL; textPDMModify.acceleratorP = TRUE; textPDMInfo.mnemonic = 0; textPDMModify.mnemonic = FALSE; textPDMInfo.mneIndex = 0; textPDMModify.mneIndex = FALSE; mdlDialog_textPDMItemIns (&newMenuItem, exportMenuP, NULL, &textPDMInfo, &textPDMModify); }

Any help is greatly appreciated.

Foo.
 
The MS_DGNAPPS that I have specified are fully loaded before MicroStation has a chance to build the main menu bar. To test this, try:

if (mainMenuBarP != NULL)
exportMenuP = mdlDialog_menuBarFindMenu (mainMenuBarP, RTYPE_PulldownMenu, PULLDOWNMENUID_SubExport); else {mdlDialog_openAlert ("Menubar not found");return}

If the menubar doesn't exist yet (I'm guessing it doesn't), try to queue a command using mdlInput_sendCommand that will insert the Export menu item. Queued commands shouldn't be called until MicroStation has finished initializing. I haven't tested this but it seems to make sense at the moment.
 
Mr. Steve

You are right! Thanks very much.
BTW. I want ask an associated question.
I use the function
mdlInput_sendCommand (CMD_STF2PKPM_ADDMENU, 0, INPUTQ_EOQ, mdlSystem_getCurrTaskID, DIALOGMAN); but the command CMD_STF2PKPM_ADDMENU not be executed.

So, I use mdl function
mdlDialog_cmdNumberQueue (TRUE, CMD_STF2PKPM_ADDMENU, 0, TRUE); instead of mdlInput_sendCommand. The result is correct. Why? Is command class ' DIALOGMAN' improper?

Foo.
 
Status
Not open for further replies.

Latest threads

Back
Top