Page 1 of 2
PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 7:26 pm
by vilian
Hi Guis,
I would like to know if is there some kind of GET Picture that I could specify to accept only Chars and numbers(Ex: 01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ) without alows the user to digit special chars, Is there ?
Re: PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 7:53 pm
by vilian
I found out the parameter N. IF I use PICTURE "NNNNN" it's working, but if I use PICTURE "@N" don't work. Do you know why ?
Re: PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 7:57 pm
by karinha
Veja se ajuda:
Code: Select all
LOCAL cLetraNum := SPACE(39)
@ 1, 6 GET oGet VAR cLetraNum OF oDlg SIZE 160, 10 COLOR "W/G" ;
PICTURE "@KR 99999999999-!!!!!!!!!!!!!!!!!!!!!!!!!!"
Re: PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 8:02 pm
by vilian
Karinha,
Na mesma posição eu preciso aceitar letras ou números. No caso do seu exemplos, no começo só aceita números e no final qualquer coisa. No meu caso, caracteres especiais não devem ser aceitos, mas em qualquer posição, pode-se digitar uma letra ou um numero. Entendeu ?
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 11:36 am
by Silvio.Falconi
perhpas it need a a valid function....
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 11:55 am
by vilian
Or just that PICTURE "@N" Works !
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 3:24 pm
by James Bott
Here is a link to the Clipper guide explaining all the @ Get picture options.
https://www.itlnet.net/programming/prog ... aee8c.html
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 4:47 pm
by Euclides
In Brasil, we use to say... "If everything goes wrong, see the manual"
James just posted the manual...
@ 2, 8 GET cAlpNum OF oDlg SIZE 60, 10 PICTURE "NNNNNNNNNN"
(of course, cAlpNum must be a character variable)
Regards, Euclides
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 4:55 pm
by vilian
Thank You James,
I have already known this content. I didn't undestand is why I can do PICTURE "@!" AND can't to do PICTURE "@N". Do you know ?
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 7:06 pm
by James Bott
Vilian,
I didn't understand is why I can do PICTURE "@!" AND can't to do PICTURE "@N". Do you know ?
I'm not sure I understand. Both work for me--the only difference is that @N allows lower case letters. Both allow other characters like punctuation.
Define "special characters." Do you mean characters that appear on the keyboard that are not letters or numbers (like punctuation)? Or do you mean special characters that are not on the keyboard?
James
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 7:45 pm
by vilian
James,
IF we define PICTURE "NNNN" the user will can enter only one of these chars 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ, any other will not be accepted.
IF we define PICTURE "@N" any char is accepted, but I would like to have the same behavior of PICTURE "NNNN"
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 12:17 am
by James Bott
If "@NNN" does what you want, then what is the problem? Maybe you don't want to specify the length?
Actually, "NNNN" also allows lower case letters too. Did you realize that?
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 7:54 am
by Silvio.Falconi
oGet:bChange := { | nKey,nFlag,oB|(Chr(nKey)$"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")}
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 10:49 am
by vilian
James Bott wrote:If "@NNN" does what you want, then what is the problem? Maybe you don't want to specify the length?
Actually, "NNNN" also allows lower case letters too. Did you realize that?
Yes James, but the lower case I can surround through the the property of the resource.
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 10:50 am
by vilian
Silvio.Falconi wrote:oGet:bChange := { | nKey,nFlag,oB|(Chr(nKey)$"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")}
Thank you Silvio,
This is what I will do, but directly in TGET class.