zoukankan      html  css  js  c++  java
  • Save the users last values in a dialog

    Had a case then I needed to do a modification to a report with a custom dialog where the user could make some changes to the information that teh report would show.

    I needed the same behavioure as you get from a RunBase class but I needed to use it in a report. Tha solution was to use the xSysLastValue class.

    1 client server public static container getValue(CompanyId _company,
    2 userId _userId, UtilElementType _type, identifiername _elementName
    3 [, identifiername _designName])

    The usage is pretty simple, the parameters is used to identify the correct data. One thing to remember is that if you use this method to retrieve the user data for a dialog in a report for example don't use the reports name as _elementName because you can end up with the user data for the report instead.

    To save the data you use the:

     1 client server public static void putValue(container _value, CompanyId _company,
     2 userId _userId, UtilElementType _type, identifiername _elementName
     3 [, identifiername _designName])
     4 
     5 Example: 
     6 
     7 static void SaveLastValues(Args _args)
     8 {
     9   Dialog      _dlg;
    10   DialogGroup _dlgGroup;
    11   DialogField _dlgField1;
    12   DialogField _dlgField2;
    13   container   _dialogValues;
    14   NoYesId     _choice1;
    15   NoYesId     _choice2;
    16   ;
    17 
    18   _dlg = new dialog();
    19 
    20   _dlgGroup  = _dlg.addGroup("Group");
    21   _dlgField1 = _dlg.addField(typeid(NoYesId),"Choice 1");
    22   _dlgField2 = _dlg.addField(typeid(NoYesId),"Choice 2");
    23 
    24   //Get the previouse values
    25   _dialogValues = xSysLastValue::getValue(curExt(), curUserId(), UtilElementType::Job, "SaveLastValue");
    26 
    27   //Check if we have previouse values
    28   if (_dialogValues != conNull())
    29   {
    30     _dlgField1.value(conPeek(_dialogValues, 1));
    31     _dlgField2.value(conPeek(_dialogValues, 2));
    32   }
    33 
    34   if (_dlg.run())
    35   {
    36     //Save the user choices
    37     _dialogValues = conNull();
    38     _dialogValues += _dlgField1.value();
    39     _dialogValues += _dlgField2.value();
    40 
    41     xSysLastValue::putValue(_dialogValues,curExt(),curUserId(),UtilElementType::Job,"SaveLastValue");
    42 
    43     //Do what ever
    44   }
    45 }
  • 相关阅读:
    5月13日工作日志(需求规格说明书4.0)
    第十次会议
    5月21日日志
    5月12日工作日志
    关于游戏平衡性——王者荣耀英雄伤害数值参考
    每天一点新东西(1)
    我在都匀做网优(补)
    我在都匀做网优
    不算新的开始
    input的focus事件时,鼠标光标在最后
  • 原文地址:https://www.cnblogs.com/Jinnchu/p/2659708.html
Copyright © 2011-2022 走看看