在X ++中存储击键 [英] Store Keystrokes in X++
问题描述
有人知道如何将击键作为字符串存储在X ++中吗?
Does anybody knows how to store keystroke as a string in X++?
如果我也想将它们转换为ASCII,反之亦然.
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-
在stringEdit的textChange方法中,当我输入"A"(或任何值)时,它应该显示"A行0"(在信息日志中),然后我输入B时它应该显示"AB行0"(在信息日志中).一旦我按Enter键,输入的"Q"显示应该类似于"AB Line 0"(第一行)"Q Line 1"(第二行),依此类推.我遇到"\ n"(输入)问题,因此我需要通过ASCII值来实现.谢谢.
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.
推荐答案
我看不到task()
将如何为您提供帮助.
I don't see how task()
is going to help you.
似乎当StringEdit
控件包含回车符时,当您在textChange()
方法中检查它时,StringEdit.text()
总是给出错误的结果.可能是AX错误.您至少可以在以后使用modified()
方法获得正确的结果.
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
更新.您可能可以从textChange()
触发modified()
方法-可能是hack,我没有尝试过.
Update. You can probably trigger the modified()
method from textChange()
- that would be a hack, I didn't try it.
这篇关于在X ++中存储击键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!