Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about scrolling with GET command

Status
Not open for further replies.

Danwoo

Technical User
Oct 9, 2004
13
US
Hi, programers

I need a small help regarding scrolling with GET command.
One of my memory variable is 25 char length. Due to space limitation on the screen, I wanted to do a prompt imput for this variable with 10 char spaces (but still let user input upto 25 char by scrolling to the left), so I use "@S10" picture function. But the result on the screen is:

[123456789 ]

It scrolls to the left on the "9" spot, but it still occupy 25 spaces on the screen.

I guess I am using wrong format.
Is there a correct way to do this?

Thanks.

Larry
 
A few questions:
- Can you publish the entire GET line here? It might be interaction with other PICTURE clauses.
- What compiler & version are you using? (Clipper, (x)Harbour, xBase++)

HTH
TonHu
 
Larry,

Did you initialize the variable to a default length of 20 chars before entering the get? If your variable is only 9 chars long, asking Clipper to scroll this in a 20 char field won't work.

Try this to lengthen Var_1 to Var_2:

Var_2 := Left( Var_1 + Space( 20 ), 20 )
Then use Var_2 in your get command.



Best Regards,
David Tracy
 
Addendum to last post:

Larry,
The total field length should have read 25 chars rather than 20 chars. Sorry, I'm only a little off today!



Best Regards,
David Tracy
 
Thanks for the reply guys, it is a great place for non-professional like me to get help.

Actually, it was my fault. I guess the variable init is incorrect. Now, I fix it and it is working fine now.
Here is the whole line:

M_PAX_NAME := space(25)
@ M_T_ROW+I, 2 get M_PAX_NAME picture "@!s16"

Btw, for another topic.
I found that when I represent the database table with an array in Clipper, I think it is quite cumbersome. I have to declare many arrays, one for each field (or each memvar). For example, I have to quote:

For I = 1 to 10
Lastname := .....
Firstname := ....
Tel = ....
So on..
Next

Can Clipper does like Pascal record command, that declare 1 array for the entire table?

For example:

Myrecord.lastname := ...
Myrecord.Firstname := ...
Myrecord.Tel := ...
So on…

Thanks.

Regards,

Larry
 
OOP! for TONHU,

I am using plain Clipper 5.3 (I don't know which version A/B?), no any addon library, usually link with exospace.

thanks again.

Larry
 
Hi, Larry

To load 10 records from a database into a 2-dimensional array without using field names:

select a
declare xfeeled[10,fcount()]
for i = 1 to 10
for j = 1 to fcount()
store fieldname(j) to phield
xfeeled[i, j] := &phield
next
skip
next

Jock
 
1) Problem is solved, without knowing the clipper version, that's just fine but next time it could be interesting to know ;-)
2) For OOP in conjunction with the xBase (Clipper) language have a look at xHarbour, to be found at (open source) or (commercially supported version, based on the open source code)

HTH
TonHu
 
Hi, Jock

As you mention, the only solution (I think) in clipper is using 2 dimen array. But we lost readability that we have to use index nunmber to represent a field.

But in Pascal(which I had learnt 10 years ago), it is very easy to represent an entire table.

For example in Pascal:

Local SingleRec fields Lastname, Firstname, Tel, Address
Local CustRec array of SingleRec

For I = 1 to 10
CustRec.Lastname := ...
CustRec.Firstname := ...
CustRec.Tel := ...
CustRec.Address := ...
next I

Hopefully, I can do the same format in Clipper.

Regards,

Larry
 
Hi, TonHu

Thanks for the source. I heard about it, but never get into it because someone said it need a C compiler and I don't have it.

regards,

Larry

 
There are free and 'free' C-compilers supported by xharbour.
- The Borland commandlinetools (5.51) is supported directly, but has a bit 'funny' licence (Only free for 1 developer per company), so I call it 'free', not free.
- The OpenWatcom compiler is supported for the main xharbour project, but the contributions and samples can't all be compiled because of lacking make scripts, and it's free.
- The Microsoft VC commandline compiler is free AFAIK, but has the same problems as the OpenWatcom compiler.
- GCC is supported for but Windoze & *nixes, but requires cygwin on Windows, AFAIK. It's quite free though.
These are all 32 bit compilers.

There are also free DOS-style (16 bit) compilers, but these (can) have problems with long filenames, which are used in some places. These are to be removed, but this step may have been completed already, I'm not targetting DOS platforms with xharbour, have Clipper for that ;-)

HTH
TonHu
 
I was reading old posts and got yours.

Try doing this:

#define X_LASTNAME 1
#define X_FIRSTNAME 2
#define X_TEL 3
#define X_ADDRESS 4
#define X_RECSIZE 4
... ...
MyRec:=array(n,X_RECSIZE)
...
for i:=1 to nnn
MyRec[i,X_LASTNAME] := myfile->lastname
MyRec[i,X_FIRSTNAME] := myfile->firstname
MyRec[i,X_TEL] := myfile->tel
etc....
...
next

The defines provide the desired readability . Also, use the same names or a prefixed version of the same names used in the files in order to have easy maintenance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top