Jump to content

GTRR and scrolling the screen


This topic is 3611 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi

When using GTRR to navigate to a record in the same list view layout, the destination record is displayed in unpredictable vertical locations on the screen. Sometimes it will be displayed at/near the top of the list or in the middle or right at the bottom of the screen.

 

Thus the user doesn't know where to look first to locate the record on the screen - it's annoying to have to visually scan the screen. Is there a way to force the target record to always display at/near the top of the screen, irrespective of whether it is down the list or up the list?

 

I know there is the Scroll Window script command, but I can't think how it can be used when you can't predict where the target record will be displayed.

 

Thanks in advance.

David

Link to comment
Share on other sites

You can query the record number and the found count, and you can query or set the window dimensions.

 

You know the height of the layout's header and body part.

 

These parameters should allow you to write a script like the following:

Go to Related Record [ From table: “Events”; Using layout: “Events_Chart” (Events) ] [ Show only related records; New window ]
Set Variable [ $header; Value:215 // hardcoded ]
Set Variable [ $body; Value:41 // hardcoded ]
Set Variable [ $RN; Value:Get ( RecordNumber ) ]
Set Variable [ $offset; Value:Div ( Get ( WindowContentHeight ) - $header ; $body ) - 1 ] 
If [ Let ( $goto = $RN + $offset ; Get ( FoundCount ) >= $goto ]
  Go to Record/Request/Page [ $goto ] [ No dialog ]
  Scroll Window [ To Selection ]
  Go to Record/Request/Page [ $RN ] [ No dialog ]
End If

Not extensively tested, so tweak and twiddle to your heart's content.

 

And then there's the FM13 feature to format the Active Row's appearance …  :smile:

Link to comment
Share on other sites

Is there a way to force the target record to always display at/near the top of the screen, irrespective of whether it is down the list or up the list?

 

No, that's not always possible. The last record in the found set cannot scroll higher than the bottom of the window. If your window displays say 10 records, then the last 9 records will never appear in the top position of the window.

 

 

That said, if you add the following three steps to your GTRR script:

Set Variable [ $recNum; Value:Get ( RecordNumber ) ]
Go to Record/Request/Page[ Last ]
Go to Record/Request/Page [ $recNum ][ No dialog ]

then the selected record will become the top record displayed in the window - if possible.

 

 

If it's important, considering isolating the selected record as the only record in the found set, or highlight it.

 

Link to comment
Share on other sites

  Scroll Window [ To Selection ]

 

Scroll Window [ To Selection ] scrolls to the currently active field. If no field is active (as in your script) then it does nothing. I believe that your script works by coincidence - just by going to the originally selected record from lower down in the list.

Link to comment
Share on other sites

This topic is 3611 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.