Jump to content

Navigating thru ev


Cazito

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

Recommended Posts

This is the way I did it. Buttons pass parameter to scipt which sets the number of records to skip. Stops when first or last record is reached.

Freeze Window

If [ Get ( ScriptParameter ) = -1 ]

Go to Record/Request/Page [ Previous ]

Else If [ Get ( ScriptParameter ) = 1 ]

Go to Record/Request/Page [ Next ]

Else If [ Get ( ScriptParameter ) < 0 ]

Set Field [ Globals::g_Counter; 1 ]

Loop

Go to Record/Request/Page [ Previous; Exit after last ]

Set Field [ Globals::g_Counter; Globals::g_Counter + 1 ]

Exit Loop If [ Globals::g_Counter > Abs ( Get ( ScriptParameter ) ) ]

End Loop

Else

Set Field [ Globals::g_Counter; 1 ]

Loop

Go to Record/Request/Page [ Next; Exit after last ]

Set Field [ Globals::g_Counter; Globals::g_Counter + 1 ]

Exit Loop If [ Globals::g_Counter > Abs ( Get ( ScriptParameter ) ) ]

End Loop

End If

Link to comment
Share on other sites

I was thinking more in terms of this one-line script:

Go to Record/Request/Page [Get (RecordNumber) + 10]

Which works but for two problems:

An annoying pop-up window appears with the number of the record I

Link to comment
Share on other sites

You could try this one-line script using get record number via calculation (new in FM7).

JumpBack10 script:

Go To Record/Request/Page [ No dialog;

If(Get ( RecordNumber ) < 10; 1; Get(RecordNumber) - 10) ]

Here's the Forward ...

If(Get(RecordNumber) > Get ( FoundCount ) - 10; Get(FoundCount); Get(RecordNumber) + 10) ]

Be sure to click 'No Dialog'. You could duplicate the above scripts for Jump50 and just change the number. wink.gif

Link to comment
Share on other sites

Combining all the above I came up with the following:

Freeze Window

If [ Get ( ScriptParameter ) < 0 ]

If [ Get ( RecordNumber ) > Get ( ScriptParameter ) ]

Go to Record/Request/Page [ Get ( RecordNumber ) + Get ( ScriptParameter ) ] [ No dialog ]

Else

Go to Record/Request/Page [ First ]

End If

Else If [ Get ( RecordNumber ) < Get ( FoundCount ) - Get ( ScriptParameter ) ]

Go to Record/Request/Page [ Get ( RecordNumber ) + Get ( ScriptParameter ) ] [ No dialog ]

Else

Go to Record/Request/Page [ Last ]

End If

End If

Link to comment
Share on other sites

Here's another solution. This allows you to use the same previous and next buttons.

Next:

If [ Get ( ActiveModifierKeys ) = 1 ]

Loop

Go to Record/Request/Page

[ Next; Exit after last ]

Pause/Resume Script [ Duration (seconds): 0 ]

Exit Loop If [ Get ( ActiveModifierKeys ) &#8800; 1 ]

End Loop

Else

Go to Record/Request/Page

[ Next ]

End If

Previous:

If [ Get ( ActiveModifierKeys ) = 1 ]

Loop

Go to Record/Request/Page

[ Previous; Exit after last ]

Pause/Resume Script [ Duration (seconds): 0 ]

Exit Loop If [ Get ( ActiveModifierKeys ) &#8800; 1 ]

End Loop

Else

Go to Record/Request/Page

[ Previous ]

End If

Saves a little layout space and the number of records is no longer hard-coded to 10, just release the modifier key when you have reached your destination.

Link to comment
Share on other sites

The minus sign is part of my script parameter for going back. The script parameter thus shows both direction and number of records to move. I have 3 button in each direction for 1, 5 & 10 record jumps.

Link to comment
Share on other sites

I confess that the subject of navigation, windowing and displays, within an FM7 file, is of particular interest to me. Ralph, Michael - thanks guys ... I plan on playing with both of your ideas; and also playing with the 100 new ideas that have popped into my mind. Vs 7 is incredible...

Link to comment
Share on other sites

My calculation is not the best. crazy.gif It would use less math to take advantage of Min() and Max() as The Shadow pointed out in another thread. And using a script parameter would improve it even more.

A forward version, getting the amount to move from the parameter:

Go To Record[ no dialog; Min( Get(FoundCount); Get(RecordNumber)+Get(ScriptParameter) ) ]

A backwards version:

Go To Record[ no dialog; Max( 1; Get(RecordNumber)-Get(ScriptParameter) ) ]

Then each button chooses 10 or 50. And there may be even better ways ... it seems there always are. wink.gif

Link to comment
Share on other sites

  • 3 weeks later...

Michael,

I really like this concept. I've just implemented it. Thanks for the trick. I wanted to give the user a little more time to see the record, so I changed the pause duration. In FM7 you can pause for fractional parts of seconds. In FM 6, :01 was the shortest pause you could have. Now you can set it to .1, or whatever.

Having said that, the quickest pause that it actually seems to be able to execute is about .5. That is, even if I set it to .1, it seems incapable of pausing for anything less than half a second.

Anyone else notice this, or is once again tied to the slow screen redraws?

Thanks again,

Dan

Link to comment
Share on other sites

This topic is 7234 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.