trying to keep cursor location on grid after pressing enter

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
RMV
New User
Posts: 12
Joined: Wed Jan 19, 2011 3:42 pm
First Name: Roderic
Last Name: Vosburgh
Company Name: McGard
City: Orchard Park
State / Province: New York
Zip / Postal Code: 14127
Country: United States
Contact:

trying to keep cursor location on grid after pressing enter

Post by RMV »

I have a subfile grid with input fields on each grid line. Once someone has paged down as they are editing fields and presses enter or changes a field that returns to the program with pui.click(), when program the returns, the cursor is either focused on the first field at the top of the screen above the grid, or it is not focused anywhere.

It will display the same page of records but I would like the cursor to stay put.
I used the "subfile record number" and the "return return cursor column" to pass those values to the program,
then move those values to the binding fields for the "set cursor row" and "set cursor column".

Debugging the program I can see the correct row and column are moved the the binding fields used, but it has no affect on the cursor location.
Am I missing a step somewhere?
DaveLClarkI
Experienced User
Posts: 165
Joined: Wed Dec 11, 2013 10:40 am
First Name: Dave
Last Name: Clark
Company Name: WinWholesale, Inc.
Phone: 937-294-5331
Address 1: 31101 Kettering Blvd.
City: Dayton
State / Province: Outside Canada/USA
Zip / Postal Code: 45439
Country: United States
Contact:

Re: trying to keep cursor location on grid after pressing en

Post by DaveLClarkI »

Apparently Profound doesn't take "set cursor row" and "set cursor column" to the next logical conclusion of actually setting the focus on an associated input element. Using a little simple JavaScript, though, you can do this for yourself using the onload event under the screen properties. I hope this achieves what you're looking for.

The following will get you the sequence number for your selected subfile record number:

Code: Select all

var seqno, grid = getObj(gridid);
seqno = Number(grid.pui.properties['subfile record number']);
From there, you can retrieve the "set cursor column" value and, knowing your grid widgets, you can set the focus to the associated widget as follows:

Code: Select all

getObj(widgetid + '.' + seqno).focus();
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: trying to keep cursor location on grid after pressing en

Post by David »

If the values are set properly for 'set cursor row' and 'set cursor column', then it should focus on your field.

Be aware, though, that these properties are modeled after equivalent green screen keywords which function based on row and column numbers that are relative to the entire screen. In a browser, you don't have actual rows and columns, but when you convert a screen, Profound UI assigns the original row and column numbers to the 'cursor row' and 'cursor column' properties on each widget. This is how it locates a widget for any row/column-based operations.

I'm taking a guess here based on your description of the problem, but it seems that you are basing the 'set cursor row' on a subfile record number? This is not going to result in the correct value, as Profound UI will look at the 'cursor row' value on the field. It will adjust this as needed for each subfile record. For example, let's say your subfile has 3 records, and the input box in the subfile record has cursor row = 3. This will result in input boxes with cursor row values 3, 4, and 5 in each record. Your program would then need to return one of these values (not a record number 1-3) in order to put the cursor in the proper box.

Does this explain it? Are you giving the proper value?
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: trying to keep cursor location on grid after pressing en

Post by Scott Klement »

I think it's important to understand that "subfile record number" corresponds to the SFLRCDNBR DDS keyword. It's used to set (not retrieve) the record number where the subfile is to be positioned.

There's another subfile/grid property "cursor record number" that's used to retrieve the position that the user left off on.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests