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;
    }
    
    
  • 相关阅读:
    双向循环链表
    字符串拷贝
    div样式调整.txt
    解析xml的单个节点值和循环节点消息体
    C++中的string
    正则表达式教程
    一个很好的Qt教程个人主页
    单射、双射与满射
    ISO C++ forbids declaration of * with no type
    一个中学生的个人主页
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1894050.html
Copyright © 2011-2022 走看看