grid - current row

General development discussion.

Moderators: Susan Smith, admin, Gabriel

Post Reply
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

grid - current row

Post by John »

I have a grid populating on my screen, but I need for the selected row to be a specific row (rather than the default first row) ... How does one do this?

-John
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

You mentioned a GRID and CURROW.
You set your cursor position in a GRID with CURFLD(control,CELL)

control is the position in your input statement that the grid occupies. If you are only referencing one thing, the GRID then this will be "1". If you happen to be inputting to more than one fiekd,and the second field is the grid then it woult be "2".

CELL is the cell number counting from left to right that you want to be your cursor position. So if you have a GRID of 5 columns and you want the cursor to be set to column 3 in the 5th row then its value would be 4*5+3 or 23 so you would

Code: Select all

00100 let curfld(1,23)
If your GRIS is actually a LIST then it is the same except that instead of counting 5 celss to a row you would count only 1 and would not increment for cells in the target row. You would then

Code: Select all

00100 let curfld(1,5)
FNGeorge
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

Yes - I did mean a LIST. Thank you very much fnGeorge!
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Post by John »

It's not working for me... maybe i'm doing it wrong.

so I have a screen - with about 7 rinput items on it. my second list (field 6) is the one i want to move the selected line on... so to test it out - at my rinput statement i just press ctrl+A and type CURFLD(6,12) (i'd like to hilight the 12th item from my array) and press enter - then i type go and hit enter and my screen looks exactly as it did. am i missing something?

-john

p.s. i tried this in the code immedietely after the list is populated, and it doesn't seem to work there either.
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

Does the list that you want highlighted contain the element that you are pointing at?

Is there a cursor positioning leading attribute in your MAT statement?

Are you skipping over the line that sets the cursor position?

Interrupting the program and setting CURFLD will not work, it has to be a line of code that is executed during program flow.

Code: Select all

00100 let cufld(3,6)
00200 rinput fields mat inwrk$:fld,grid1,grid2
00300 if not fkey then goto 200

Where inwrk$ contains your field specs$

Works on my machine, but I'm using 4.30. What version are you using?

FNGeorge
Post Reply