Hi Folks - I’m definately missing the concept here.
My understanding is that the form event ‘onNextRecord’ should fire just as the user attempts to move to the next record - is that correct?
If so any code associated with that event (shown in the event property) should be fired in that instance??
Currently I’m running code such as ‘application.Output(‘OnNext record was fired’)’ but this does not run when I use a a button with this code to move to the next record: ```
controller.setSelectedIndex(controller.getSelectedIndex()+1);
Q. Should not this event fire regardless of how the next record is being selected (by menu, navigator or controller call as above)???
Q. What do I need to do to run code in onNextRecord and onPreviousRecord events?
jasantana:
This could be done in the onRecodSelection. You do not have to be worried if you select it by a search or moving the record pointer.
I get that Juan, but in onRecordSelection the record has already been moved, I was hoping the onNextRecord was fired prior to the record being selected i.e. on the call to select it. I need to trap for my code on the form BEFORE the record is selected, so right now I need to put the trap and global call in both my buttons for NextRecord and PrevRecord. I was attempting to minimise the code in the form as far as possible.
Kahuna:
So only ever fired if the Servoy menu is shown and used Victor???
exactly
So the wiki says this:
WIKI:
onNextRecord
The method that overrides the Servoy menu item Select > Next Record.
This property is automatically set to “DEFAULT” (no override) when the form is created.
Parameters
{JSEvent} event – the event that triggered the action
How can we override an event that can only be fired from the menu???
Can someone from Servoy comment on / clarify the proper use of the onNextRecord events please considering the Wiki text and the fact that there is no event fired when using code to move record???
If you look in the properties view you see all those ‘events’ are listed under ‘Commands’ (when ‘show Categories’ (the tree icon) enabled). These are optional overrides for the menu commands (including their short-cuts)
Under ‘Events’ you see the real form events.
If you look in the properties view you see all those ‘events’ are listed under ‘Commands’ (when ‘show Categories’ (the tree icon) enabled). These are optional overrides for the menu commands (including their short-cuts)
Under ‘Events’ you see the real form events.
Thanks Robert - that’s what Victor was specifying to me - thanks to both of you.
So, is there a benefit to using the command like this, as opposed to running code on a button onAction to progress records??
Lets say you use a main form with a (hidden) tabpanel for navigating your screens. But you like to keep using the menubar commands for navigating your foundsets.
Then you need to override these commands to make sure they act on the selected form and not the frontmost.
But yes, it would do the same as a button onAction for that specific form.