RalphL Posted June 5, 2004 Posted June 5, 2004 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
Cazito Posted June 5, 2004 Author Posted June 5, 2004 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
MoonShadow Posted June 5, 2004 Posted June 5, 2004 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.
RalphL Posted June 5, 2004 Posted June 5, 2004 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
RalphL Posted June 5, 2004 Posted June 5, 2004 I learned from this too and now have a better script in my database.
Cazito Posted June 5, 2004 Author Posted June 5, 2004 And this is what to do if you want to go 10 records backwards: Go To Record/Request/Page [No dialog; If ( Get ( RecordNumber ) < 10; 1 ; Get ( RecordNumber ) - 10) ]
Michael Myett Posted June 5, 2004 Posted June 5, 2004 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 ) ≠ 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 ) ≠ 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.
RalphL Posted June 5, 2004 Posted June 5, 2004 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.
MoonShadow Posted June 6, 2004 Posted June 6, 2004 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...
MoonShadow Posted June 6, 2004 Posted June 6, 2004 My calculation is not the best. 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.
The Shadow Posted June 25, 2004 Posted June 25, 2004 Here's one, it scripts movement to the next/previous letter in the alphabet from your current record.
DanBrill Posted June 25, 2004 Posted June 25, 2004 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
Recommended Posts
This topic is 7458 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 accountSign in
Already have an account? Sign in here.
Sign In Now