将击键存储在 X++ 中

发布于 2024-10-26 01:29:38 字数 687 浏览 1 评论 0原文

有谁知道如何在 X++ 中将击键存储为字符串?

如果我想将它们转换为 ASCII,反之亦然。

下面的工作没有显示预期的行为。

public void textChange() 
{ 
       int i, j; 
       int L = 12; 
       int h = 4; 
       int t = 54; 
       str tmpStr; 
   ;  

  i =  strLen(strKeep(seField.text(), '\n')); 
  info(seField.text() + ' Lines: ' + int2str(i)); 
  super(); 
  if (i >= H) 
 { 
  error(strFmt("max lines = %1", h));  
 } 
} 

   Actually i am trying to implement something like- 

在 stringEdit 的 textChange 方法中,当我输入“A”(或任何值)时,它应该显示“A line 0”(在信息日志中),然后我输入 B 它应该显示“AB line 0”(在信息中)。一旦我按下回车键,输入“Q”显示应该类似于“AB Line 0”(第一行)“Q Line 1”(第二行)等等。我遇到了“\n”(Enter)的问题,所以我需要通过 ASCII 值来实现这一点。谢谢。

Does anybody knows how to store keystroke as a string in X++?

And also if I want to covert them to ASCII and vise-versa.

And the below job does not shows the expected behaviour.

public void textChange() 
{ 
       int i, j; 
       int L = 12; 
       int h = 4; 
       int t = 54; 
       str tmpStr; 
   ;  

  i =  strLen(strKeep(seField.text(), '\n')); 
  info(seField.text() + ' Lines: ' + int2str(i)); 
  super(); 
  if (i >= H) 
 { 
  error(strFmt("max lines = %1", h));  
 } 
} 

   Actually i am trying to implement something like- 

in a textChange method of stringEdit when i enter "A"(or any value) it should display "A line 0"(in info log) then i enter B it should display "AB line 0" (in info). Once i press enter and the enter "Q" display shoud be something like "AB Line 0"(1st line) "Q Line 1"(2nd line) and so on. I face problem with "\n"(Enter) So I need to achieve this through ASCII value. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不再让梦枯萎 2024-11-02 01:29:38

在 AX 表单中存储击键的唯一方法是使用表单上的 task() 方法。

但不要为了您评论的目的而这样做!

而是使用枚举值或包含相关值的组合框来获得所需的行为。

更新:
您可以在这里找到有关此主题的一些有用信息:http://www.axaptapedia.com/FormComboBoxControl< br>
在这里: http://blogs.msdn.com/ b/palle_agermark/archive/2005/06/30/434146.aspx

The only way to store keystrokes in an AX form is use the task() method on the form.

But do not do it for the purpose you commented on!

Rather use a enum value or a combobox feeded with the relevant values to get the wanted behavior.

UPDATE:
You may find some useful information on this subject here: http://www.axaptapedia.com/FormComboBoxControl
and here: http://blogs.msdn.com/b/palle_agermark/archive/2005/06/30/434146.aspx

紫南 2024-11-02 01:29:38

我不知道 task() 对您有什么帮助。

似乎当 StringEdit 控件包含回车符时,当您在 textChange() 中检查时 StringEdit.text() 总是给出错误的结果方法。可能是 AX 错误。您至少可以使用 modified() 方法来获得正确的结果。

Exportfile for AOT version 1.0 or later
Formatversion: 1

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #TestForm1
  PROPERTIES
    Name                #TestForm1
  ENDPROPERTIES

  METHODS
    Version: 3
    SOURCE #updateOutput
      #void updateOutput()
      #{
      #    container c = str2con(Input.text(), '\n');
      #    int i;
      #    str s;
      #    ;
      #
      #    for (i = 1; i <= conlen(c); i++)
      #        s += strfmt("Line %1: %2\n", i, conpeek(c, i));
      #
      #    Output.text(s);
      #}
    ENDSOURCE
    SOURCE #classDeclaration
      #public class FormRun extends ObjectRun
      #{
      #
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES

  ENDOBJECTBANK

  JOINS
  ENDJOINS

  DESIGN
    PROPERTIES
    ENDPROPERTIES

    CONTAINER
      CONTROL STRINGEDIT
        PROPERTIES
          Name                #Input
          AutoDeclaration     #Yes
          Width               #Column width
          Height              #Column height
          MultiLine           #Yes
        ENDPROPERTIES

        METHODS
          Version: 3
          SOURCE #modified
            #public boolean modified()
            #{
            #    boolean ret = super();
            #    ;
            #
            #    element.updateOutput();
            #
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #textChange
            #public void textChange()
            #{
            #    super();
            #
            #    element.updateOutput();
            #}
          ENDSOURCE
        ENDMETHODS
      ENDCONTROL

      CONTROL STRINGEDIT
        PROPERTIES
          Name                #Output
          AutoDeclaration     #Yes
          AllowEdit           #No
          Width               #Column width
          MultiLine           #Yes
        ENDPROPERTIES

      ENDCONTROL

    ENDCONTAINER

  ENDDESIGN

ENDFORM

***Element: END

更新。您可能可以从 textChange() 触发 modified() 方法 - 这将是一种黑客行为,我没有尝试过。

I don't see how task() is going to help you.

It seems that when the StringEdit control contains carriage returns, StringEdit.text() is always giving a wrong result when you're checking it in the textChange() method. Probably an AX bug. You can use the modified() method to get the correct result at least afterwards.

Exportfile for AOT version 1.0 or later
Formatversion: 1

***Element: FRM

; Microsoft Dynamics AX Forms unloaded
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #TestForm1
  PROPERTIES
    Name                #TestForm1
  ENDPROPERTIES

  METHODS
    Version: 3
    SOURCE #updateOutput
      #void updateOutput()
      #{
      #    container c = str2con(Input.text(), '\n');
      #    int i;
      #    str s;
      #    ;
      #
      #    for (i = 1; i <= conlen(c); i++)
      #        s += strfmt("Line %1: %2\n", i, conpeek(c, i));
      #
      #    Output.text(s);
      #}
    ENDSOURCE
    SOURCE #classDeclaration
      #public class FormRun extends ObjectRun
      #{
      #
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
    PROPERTIES
    ENDPROPERTIES

  ENDOBJECTBANK

  JOINS
  ENDJOINS

  DESIGN
    PROPERTIES
    ENDPROPERTIES

    CONTAINER
      CONTROL STRINGEDIT
        PROPERTIES
          Name                #Input
          AutoDeclaration     #Yes
          Width               #Column width
          Height              #Column height
          MultiLine           #Yes
        ENDPROPERTIES

        METHODS
          Version: 3
          SOURCE #modified
            #public boolean modified()
            #{
            #    boolean ret = super();
            #    ;
            #
            #    element.updateOutput();
            #
            #    return ret;
            #}
          ENDSOURCE
          SOURCE #textChange
            #public void textChange()
            #{
            #    super();
            #
            #    element.updateOutput();
            #}
          ENDSOURCE
        ENDMETHODS
      ENDCONTROL

      CONTROL STRINGEDIT
        PROPERTIES
          Name                #Output
          AutoDeclaration     #Yes
          AllowEdit           #No
          Width               #Column width
          MultiLine           #Yes
        ENDPROPERTIES

      ENDCONTROL

    ENDCONTAINER

  ENDDESIGN

ENDFORM

***Element: END

Update. You can probably trigger the modified() method from textChange() - that would be a hack, I didn't try it.

寂寞美少年 2024-11-02 01:29:38

尝试字符串控件的 SearchMode 属性。为了有用,字符串值必须映射到索引表字段。

Try the SearchMode attribute of string control. To be useful the string value has to be mapped to an indexed table field.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文