zoukankan      html  css  js  c++  java
  • Set focus on the dialog field

    1)Problem Statment:
    Hi,

    I have this requirement, i have a run base class with a dialog Field. i need
    to validate the vaue in the field and i need to set focus on the field if the
    value is not validated. The problem is dialogfield does not have setFocus
    method.
    Can any one help me out in this regards.

    Solution :
    As you right noticed really dialogfield doesn’t have setFocus. And not only

    setFocus. Dialog was developed just for simple user input.
    The better decision in this case is creating separate form where you may
    override every control’s event and in a dialog method of your runBase class
    call this form.
     
    Take a look for example at \Classes\WMSShipmentShip and
    > \Forms\SysProjectFilter.

    If you eagerly wish set focus in dialog there is nothing impossible

    // here we achieve myCtrl
    public void dialogPostRun(DialogRunbase dialog)
    {
        super(dialog);

        myCtrl =
    dialog.dialogForm().formRun().control(dialogTransDate.control().id());
    }

    in method where you validate:
    myCtrl.setFocus();

    But I’d like to say again
    the better solution is sepate form

    2) on the report's Dialog field

    public boolean  getFromDialog()
    {
    ;
        g_FromDate          = dlg_DialogField1.value();
        g_ToDate            = dlg_DialogField2.value();
        g_VendAccount1      = dlg_DialogField3.value();
        g_VendAccount2      = dlg_DialogField4.value();
        isRank              = dlgisRank.value();
        g_ItemBuyerGroupId  = dlg_DialogField7.value();
        g_RankPosition      = dlg_DialogField8.value();
        if(isRank && g_RankPosition == 0)
        {
            //DialogRunbase   dialog; //global variable
            dialog.dialogForm().formRun().control(dlg_DialogField8.control().id()).setFocus();
            //setFocus for the dlg_DialogField8
            throw Error("Please enter number of records for vendor ranking");
        }
        return true;
    }
    
    
  • 相关阅读:
    hdu 1251(字典树)(3种方法)
    HDU 2203(KMP算法)
    九度oj 题目1335:闯迷宫
    poj3894 bfs+记录路径
    状压dp--P2704
    状压dp--洛谷P2622
    动态规划--牛客多校number
    完全背包
    01背包--hdu
    莫比乌斯反演模板--Gym 101982B
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1894050.html
Copyright © 2011-2022 走看看