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;
    }
    
    
  • 相关阅读:
    SQL(二)语法
    SQL(一)简介
    linux学习(六)文件基本属性
    Linux学习(五)远程登录
    Linux学习(四) 忘记密码解决方法
    怎样理解阻塞非阻塞与同步异步的区别?
    Python的lambda匿名函数
    Twisted源码分析系列01-reactor
    Python装饰器学习(九步入门)
    Python关键字yield的解释
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1894050.html
Copyright © 2011-2022 走看看