//Soondy@Champway CHM- Copy from JimmyHUANG
//此方法同系统标准功能GotoTheMainTable类似.可以放在控件的context()中.jumpRef()也可试试.
public void context()
{
    element.GoToMainTable(this,True,"");
}

void GoToMainTable( Object _ctrl, Boolean  IsparmObject = false,str RefFrom = '' )
{
#WinAPI
    DictType      _dictType;
    str                cTable;
    int i, selectedMenu;
    args args;
    formrun formrun;
    common common;
    DictTable dt;
    int nTableID;
    int nFieldID;

    PopupMenu   master     = new PopupMenu(element.hWnd());  //Master is created
    int         masterItem = master.insertItem('@SYS7706');           //An item is inserted in Master. The return value is unique, and is used later as the items id.
    int         breakItem  = master.insertBreak();                            //Insert a horizontal separator.
    int         CancelItem = master.insertItem('@SYS30312');

    selectedMenu = master.draw();                                        //Draw the popupmenu on the screen and wait for user selection.

    switch (selectedMenu)
    {
        case -1:                                                                  //If nothing is selected -1 is returned.
            break;

        case masterItem:


             _dictType = new dictType(_ctrl.extendedDataType());
             if (_dictType)
             {
                 nTableID = _dictType.relationObject(1).table();
                 nFieldID = _dictType.relationObject(1).lineExternTableValue(1);
                 cTable = tableid2name(nTableID);
             }
             IF(!RefFrom)  RefFrom = cTable;

             cTable= RefFrom;

              If(cTable && TreeNode::findNode('\\Forms\\'+RefFrom))
              {
                 args = new args(RefFrom);

              //if (IsparmObject) args.parm(element.RefcustAccount());//other function.
              formrun = ClassFactory.FormRunClass(args);
              formrun.init();
              formrun.run();
              formrun.detach();
               }

            break;
    }
}