Page 1 of 1

Change te picture of a get according the contents

Posted: Sun Apr 23, 2006 10:20 am
by Willy
Hello,

A Belgium bank nr always have the same picture.
999-9999999-99

Sometimes the client is from another country and has a bank nr with another picture.

How can I change the picture of the field when the window is running.

The idea is to start all nrs with "BE"

So the picture will be :

"!!-999-9999999-99"

where the first 2 characters will be by default "BE"

When the get got focus the position of the cursor should be 4.

When the content of the first 2 characters is "BE" the picture should have to be "!!-999-9999999-99"
Otherwise the picture should be "!!-xxxxxxxxxxxxxxx"

Does anybody have an idea how to fix this.

Thanks

Willy Hermans.

Thanks,

Willy

Posted: Mon Apr 24, 2006 5:25 pm
by James Bott
You could try using ON CHANGE and changing the picture (oGet:oGet:cPicture).

But I would just let the user type in whatever they want, then post process it to put it in the correct format and put it back into the GET. If it doesn't appear to be valid data, then you can turn the background a different color to signify that the data is invalid.

James

Posted: Wed Apr 26, 2006 8:08 am
by Willy
Thanks James,

I have tried it this way, and indeed this is a better way.

Thanks for the advice.

Willy.

Posted: Wed Apr 26, 2006 10:29 am
by Vladimir Grigoriev
Maybe you should use ComboBox (or other control) to let a user select approciated picture format himself?

Vladimir Grigoriev

Posted: Sun Apr 30, 2006 7:31 am
by DanielPuente
Vladimir:

You can change the get picture whenever you want with:

IF CRUB==1
oPuni:oGet:Picture:='999,999.9999'
oPuni:Refresh()
ELSE
oPuni:oGet:Picture:='999,999.99'
oPuni:Refresh()
ENDIF

Regards,