[V8i MDL] "Move element" keyin

Hi,

Having problem figuring out how to send a "move element" keyin from a pushbutton on a dialog.

This is the resource definition:
DItem_PushButtonRsc PUSHBUTTONID_MoveFlag =
{
  NOT_DEFAULT_BUTTON, NOHELP, MHELP,
  NOHOOK, NOARG, CMD_MOVE , MCMD, "element", "~Move"
};

 It does not appear there is a 1:1 map from cmdlist.h to keyin commands.

Thanks for the help!


v08.11.09.908, VS2005

  • It does not appear there is a 1:1 map from cmdlist.h to keyin commands

    Often, the first command is a prelude to a more complex command. It may not be implemented (i.e. MOVE alone may do nothing). 

    CMD_MOVE                  
    CMD_MOVE_LEFT             
    CMD_MOVE_RIGHT            
    CMD_MOVE_UP               
    CMD_MOVE_DOWN             
    CMD_MOVE_FENCE            
    CMD_MOVE_ACS              
    CMD_MOVE_PARALLEL         
    CMD_MOVE_PARALLEL_DISTANCE
    CMD_MOVE_PARALLEL_KEYIN   
    CMD_MOVE_PARALLEL_ICON    
    

    Additionally, try recording a VBA macro while you exercise the MOVE command, and see what the macro recorder creates.

    I've noticed over the years that some commands have moved from cmdlist.h to another header, which may not be published.

     
    Regards, Jon Summers
    LA Solutions

  • Move Element command is not defined in cmdlist.r.h. It has been separated in MDL application TRANSFRM. So we can implement your requirement like this:

    DItem_PushButtonRsc PUSHBUTTONID_DialogDemo1 =
        {
        NOT_DEFAULT_BUTTON, NOHELP, LHELPCMD, NOHOOK,
        0, CMD_MDL_KEYIN, MCMD, "Transfrm Move Icon", "~Move"
        };



  • Move Element command is not defined in cmdlist.r.h. It has been separated in MDL application TRANSFRM

    A useful answer.  But...

    • How does one determine that a MicroStation command is implemented in a separate MDL app? 
    • How does one determine the key-ins accepted by that app?

     
    Regards, Jon Summers
    LA Solutions

  • It is truely not easy. I first got the keyin MOVE ICON by recording a MVBA macro. Then I searched MoveElement under the folder C:\Program Files (x86)\Bentley\MicroStation V8i (SELECTseries)\MicroStation\mdl\include and found file transfrm.ids. So I can determined the MOVE ICON command is in TRANSFRM application.



  • It is truely not easy

    Thanks!  Unfortunately your approach doesn't work with the CONNECT SDK.

    I can't find any transfrm or *.ids file in CONNECT SDK include.

     
    Regards, Jon Summers
    LA Solutions

  • Transfrm.ma is a required application located in the MdlSys\Required folder.

    Background...
    Sometime after MicroStation V8's early releases; more and more CMD_ id macros were removed/isolated into respective owning applications though in most cases their new/updated IDs were not published.  So, IMHO YongAn's example above is a very nice and concise universal way illustrating how to assign Any MicroStation key-in string behind an MDL dialog UI item as a resource command.  Given there are other ways dynamic and XCommand ways to achieve a similar result.

    Code Snip...
    The following code snip can be used to identify and reconstruct more command specifics in case you wish to re-use command numbers vs. key-ins in your code.  In the simplest form (some additional validation may be needed) you can use this code snip to "click around the interface" to obtain: MdlProcID, MdlTaskID (App Name), CommandNumber, and Key-in text of a filtered input queue item. 

    // FUNC: MdlMain
    
    // Set a MicroStation key-in command event monitor
    InputCallback::SetCommandFilterFunction(OnCommandFilter);
    
    // FUNC: OnCommandFilter
    
    static CommandFilterReturnValue OnCommandFilter (Inputq_element* iqel)
    {
    	CommandFilterReturnValue rtc = INPUT_COMMAND_ACCEPT;
    	WString ws = L"";
    	long lProcID = mdlSystem_getProcessNumberFromMdlDesc(mdlSystem_findMdlDesc(iqel->u.cmd.taskId));
    	switch (iqel->hdr.cmdtype)
    	{
    	case CMDNUM: mdlParse_reconstructFullKeyin(ws,iqel->u.cmd.taskId,iqel->u.cmd.command,iqel->u.cmd.unparsed);	break;
    	case KEYIN: ws = iqel->u.keyin.keyin; break;
    	default: ws.Sprintf(L"UNKNOWN-cmdtype: %d", iqel->hdr.cmdtype); break;
    	}
    	WString wsFmt = L"EVENT,OnCommandFilter,[0x%08x],%ls,0x%I64x,%ls";
    	Log(ws, wsFmt.GetWCharCP(), lProcID, iqel->u.cmd.taskId, iqel->u.cmd.command, ws);
    	return rtc;
    }

    HTH,
    Bob