Home > Archive > Getting Started with dBASE > July 2005 > Changing lenth of a entryfield not wanted.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Changing lenth of a entryfield not wanted.
evilaro

2005-07-26, 8:23 pm

To all:

This problem does not happend using dbASE IV in DOS but it happens
in dBASE 5.7 in windows...


We have a problem with the @ GET with the Visual dBASE 5.7

We want to have a fixed length input, but when we press <Del> or <BackSpace>
the length of the input variable is beeing reduced.
There is no way to increase again the length till we delete completily (so
no space at all), then we can increase the length the variable without
seeing its value.

Run the following code,
At the beginning the display is [ ] = 5 spaces
If by mistake we delete a space
like typing "1234<Del><Return>" the display is [1234]
But we need 5 length code and we can not introduce it!!!

We have to delete the rest od the value
typing "<Del><Del><Del><Del><Return>" the display is []
Now we can introduce "12345<Return>" and we got "Your code is 12345"

SET DELIMITERS TO "[]"
SET DELIMITERS ON
MyCode = " "
DO WHILE .T.
CLEAR
@ 01,01 SAY "Code:" GET MyCode picture "#####"
READ

*Now We would seek the Code into the Table
*SEEK MyCode
*IF FOUND()
* EXIT
*ENDIF
*
*We simulate that the code is found if it is a 5 length code
IF VAL(MyCode)>0 .AND. LEN(MyCode)=5
? "Your code is ", MyCode
WAIT
EXIT
ENDIF

ENDDO

With the dBASE IV the length of the variable was not modified with the <Del>
or <BackSpace>!!

Is there any PICTURE or FUNCTION to force a minimum length?
Should we create the variable in a different way?

Thanks

Emilio




Robert Bravery

2005-07-26, 8:23 pm

HI,

What you would need to do is add the extra space onto the end of the
variable. Bu first making sure all space are out then addin the correct
ammount:

MyCode = MyCode+space(5- len(ltrim(trim(MyCod
e))))
by adding the difference of 5, which is the length of the field and that
already there, you are keeping the variable to a maximim and minimum of 5
so if mycode was "ab the we woul ad 3 spaces to it by by taking 5- the
length of mycode, bneing 3. so mycode = "ab" + 3 spaces = "ab "

Hope it is clear

Robert


"evilaro" <buzon@evil.es> wrote in message
news:nXl8SYikFHA.1528@news-server...
> To all:
>
> This problem does not happend using dbASE IV in DOS but it happens
> in dBASE 5.7 in windows...
>
>
> We have a problem with the @ GET with the Visual dBASE 5.7
>
> We want to have a fixed length input, but when we press <Del> or

<BackSpace>
> the length of the input variable is beeing reduced.
> There is no way to increase again the length till we delete completily (so
> no space at all), then we can increase the length the variable without
> seeing its value.
>
> Run the following code,
> At the beginning the display is [ ] = 5 spaces
> If by mistake we delete a space
> like typing "1234<Del><Return>" the display is [1234]
> But we need 5 length code and we can not introduce it!!!
>
> We have to delete the rest od the value
> typing "<Del><Del><Del><Del><Return>" the display is []
> Now we can introduce "12345<Return>" and we got "Your code is 12345"
>
> SET DELIMITERS TO "[]"
> SET DELIMITERS ON
> MyCode = " "
> DO WHILE .T.
> CLEAR
> @ 01,01 SAY "Code:" GET MyCode picture "#####"
> READ
>
> *Now We would seek the Code into the Table
> *SEEK MyCode
> *IF FOUND()
> * EXIT
> *ENDIF
> *
> *We simulate that the code is found if it is a 5 length code
> IF VAL(MyCode)>0 .AND. LEN(MyCode)=5
> ? "Your code is ", MyCode
> WAIT
> EXIT
> ENDIF
>
> ENDDO
>
> With the dBASE IV the length of the variable was not modified with the

<Del>
> or <BackSpace>!!
>
> Is there any PICTURE or FUNCTION to force a minimum length?
> Should we create the variable in a different way?
>
> Thanks
>
> Emilio
>
>
>
>



Roland Wingerter

2005-07-27, 3:23 am

evilaro wrote:
>
> We have a problem with the @ GET with the Visual dBASE 5.7

-------
Have you considered using an entryfield?

Roland



Ken Mayer [dBVIPS]

2005-07-27, 7:23 am

Roland Wingerter wrote:
> evilaro wrote:
>
>
> -------
> Have you considered using an entryfield?


With @/Get? I don't think it works like that. <g>

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
evilaro

2005-07-27, 9:23 am

Robert:


Thanks, I will try it....

Is a old aplication and I dont want to change it... but this is a annoying
problem
that has to be solved..

Thanks

Emilio

"Robert Bravery" <me@u.com> escribió en el mensaje
news:az5$HzikFHA.1760@news-server...
> HI,
>
> What you would need to do is add the extra space onto the end of the
> variable. Bu first making sure all space are out then addin the correct
> ammount:
>
> MyCode = MyCode+space(5- len(ltrim(trim(MyCod
e))))
> by adding the difference of 5, which is the length of the field and that
> already there, you are keeping the variable to a maximim and minimum of 5
> so if mycode was "ab the we woul ad 3 spaces to it by by taking 5- the
> length of mycode, bneing 3. so mycode = "ab" + 3 spaces = "ab "
>
> Hope it is clear
>
> Robert
>
>
> "evilaro" <buzon@evil.es> wrote in message
> news:nXl8SYikFHA.1528@news-server...
> <BackSpace>
(so[color=darkred]
> <Del>
>
>



evilaro

2005-07-27, 9:23 am

Tooooo late ....

Ken got us.

This is a old aplicarion, and to use a Entryfield I will have to make a
major upgrading ... just wanted to fix this little detail.

Thanks
Emilio


"Roland Wingerter" <RW@germany.de> escribió en el mensaje
news:tLjUBlnkFHA.1528@news-server...
> evilaro wrote:
> -------
> Have you considered using an entryfield?
>
> Roland
>
>
>



Roland Wingerter

2005-07-27, 9:23 am

Ken Mayer [dBVIPS] wrote:
> Roland Wingerter wrote:
>
> With @/Get? I don't think it works like that. <g>

---------
No, I meant in place of @Get. ;-)

Roland



Ken Mayer [dBVIPS]

2005-07-27, 11:23 am

Roland Wingerter wrote:
> Ken Mayer [dBVIPS] wrote:
>
>
> ---------
> No, I meant in place of @Get. ;-)


Note that he said it's an old app that he doesn't want to change.
Changing from @/Get to forms is not a simple process, even if you use
the conversion routines ...

Ken

--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
Roland Wingerter

2005-07-27, 1:24 pm

Ken Mayer [dBVIPS] wrote:
>
> Note that he said it's an old app that he doesn't want to change.

-------
Yeah, but that was after my reply...

Roland


nelson littaua

2005-07-28, 9:23 am

If you are not interested with the previous values of mycode entered you can move MyCode = " " inside the Do While statement and that solves the varying length of the variable.

Nelson

evilaro Wrote:

> Robert:
>
>
> Thanks, I will try it....
>
> Is a old aplication and I dont want to change it... but this is a annoying
> problem
> that has to be solved..
>
> Thanks
>
> Emilio
>
> "Robert Bravery" <me@u.com> escribió en el mensaje
> news:az5$HzikFHA.1760@news-server...
> (so
>
>


Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com