June 5, 200421 yr 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
June 5, 200421 yr Author 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
June 5, 200421 yr 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.
June 5, 200421 yr 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
June 5, 200421 yr Author 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) ]
June 5, 200421 yr 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.
June 5, 200421 yr 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.
June 6, 200421 yr 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...
June 6, 200421 yr 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.
June 25, 200421 yr Here's one, it scripts movement to the next/previous letter in the alphabet from your current record.
June 25, 200421 yr 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
Create an account or sign in to comment