FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PICTURE for only Numbers and Chars
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 07:26 PM

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 ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 07:53 PM

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 ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 07:57 PM
Veja se ajuda:

Code (fw): Select all Collapse
   LOCAL cLetraNum := SPACE(39)

   @ 1,    6 GET oGet VAR cLetraNum OF oDlg SIZE 160, 10 COLOR "W/G" ;
      PICTURE "@KR 99999999999-!!!!!!!!!!!!!!!!!!!!!!!!!!"
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: PICTURE for only Numbers and Chars
Posted: Mon Jul 08, 2019 08:02 PM

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 ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 11:36 AM

perhpas it need a a valid function....

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 11:55 AM

Or just that PICTURE "@N" Works !

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 03:24 PM
Here is a link to the Clipper guide explaining all the @ Get picture options.

https://www.itlnet.net/programming/program/Reference/c53g01c/ngaee8c.html
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 159
Joined: Wed Mar 28, 2007 01:19 PM
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 04:47 PM

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

Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 04:55 PM
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 ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 07:06 PM
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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: PICTURE for only Numbers and Chars
Posted: Tue Jul 09, 2019 07:45 PM
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"
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 12:17 AM

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?

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 07:54 AM

oGet:bChange := { | nKey,nFlag,oB|(Chr(nKey)$"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ")}

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 10:49 AM
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.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: PICTURE for only Numbers and Chars
Posted: Wed Jul 10, 2019 10:50 AM
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.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil