Hi Alessandro,
What I tried and works is add a textChange method to your control
with the following code:
public void textChange()
{
str s;
container sel;
int periods[3];
int i;
;
super();
periods[1] = 3;
periods[2] = 6;
periods[3] = 11;
s = this.text();
if (strlen(oldS) < strlen(s))
{
for (i=1; i<=3; i++)
{
if (strlen(s) == periods[i]-1)
{
s = s+".";
this.text(s);
this.setSelection(periods[i],periods[i]);
}
else
if (strlen(s) > periods[i]-1 && substr(s,periods[i],1) !
= ".")
{
s = substr(s,1,periods[i]-1) + "." + substr(s,periods
[i],1000);
this.text(s);
sel = this.getSelection();
this.setSelection(conpeek(sel,1)+1,conpeek(sel,2)+1);
}
}
}
oldS = s;
}
I think this code solves most issues in this.
The positions of the periods must be placed in the array, in order.
(so not 11, 6, 3 but 3, 6, 11)
Only thing not solved is what to do if characters in between are
removed, just try it to see what you get. :-)
And no, as far as I know there's no standard method in Axapta to do
this (like a mask or something).
Regards,
Nico
--- In development-axapta@yahoogroups.com, "Alessandro Ghidini"
<[EMAIL PROTECTED]> wrote:
>
> Hi group.
>
> I'm quite new on axapta at least for the x++ aspect.
>
> For my customer I'm developing a little customization in
LedgerTable. They
> want the AccountNum composed by 2 digits or two digits dot 2 digits
or two
> digits dot two digits dot 4 digits i.e.:
>
> 00
>
> 00.11
>
> 00.11.222222
>
>
>
> Can anyone explain me how to develop a text control and a grid cell
that
> automatically formats the account num in this way? I need a control
that
> realizes the same behaviour, as an example, as the ip text box in
windows
> which automatically adds the dots in the right places.
>
>
>
> Is it possible?
>
>
>
> Thanks in advance,
>
> Alessandro
>
>
>
>
>
>
>
> Ghidini Ing. Alessandro
>
> Kibuz SRL
>
> Galleria Ludovico Mortara, 2 - 46100 - Mantova
>
> Telefono: +39 0376 220605
>
> Fax: +39 0376 367439
>
> Email: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
>
>
>
>
>
>
>
> [Non-text portions of this message have been removed]
Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.