ProBindingSource offend event strange behaviour

Posted by Admin on 26-Nov-2009 10:10

Hi,

     I've been trying to make batching in one of my grids. So i've wrote some code, in form constructor there's bindingsource init and first data download. Works great. Next i have offend event subscribed to the bindingsource, in this event all the magic happends and new data is appended to the local temp-table. It works great when i'm scrolling grid using scrollbar. Once i use keyboard, arrow buttons, it is firing the offend event before currentchanged. Why? Feature or bug? So i've made a condition to download data only when fifth row from the end is displayed. Ok, works until I use arrows. Offend event is firing but data isn't appended and after that even scrollbar stops working properly (in term of firing offend event). Maybe I've missed something. Anny suggestions?

All Replies

Posted by Håvard Danielsen on 27-Nov-2009 07:06

Once i use keyboard, arrow buttons, it is firing the offend event before currentchanged.

Why is this a problem? The currentchanged event is typically not involved when you use the built in batching support.

Posted by Admin on 27-Nov-2009 07:11

I thought that offend event is firing only whe you are on the end of data, so you know when you can append more data, not on every row change.

Posted by Håvard Danielsen on 27-Nov-2009 07:28

Yes, offend fires only when you are at/near the end. You can use currentchanged also when you are batching, but you typically do not need to use it to manage batching.

Posted by Admin on 27-Nov-2009 08:51

hdaniels wrote:

Yes, offend fires only when you are at/near the end. You can use currentchanged also when you are batching, but you typically do not need to use it to manage batching.

The thing is i'm not using currentchanged (there's only a message to inform me when it is firing), but my offend fires always when i use arrows to navigate through grid (navigating far from end).

Posted by Håvard Danielsen on 27-Nov-2009 09:58

The thing is i'm not using currentchanged (there's only a message to inform me when it is firing), but my offend fires always when i use arrows to navigate through grid (navigating far from end).

That certainly sounds wrong, but is very unlikely to be a problem with the actual offend event. In my experience the offend event is reliable and explainable, but sometimes hard to predict up front. My first guess would be that the bindingsource sort does not match the grid sort, so that the last record of the bindingsource is visible in the grid. Advanced controls may have features that require read of all data, for example a grid's default support for grouping, sorting and filtering may cause the offend event to fire even if the user is not at the end of the batch, but this should not normally be an issue while navigating.  Also keep in mind that using ABL's input blocking messages to debug can be misleading, since .NET (sometimes?) doesn't wait for the message in an event. You can basically only rely on the info from the first message.

Message was edited by: Havard Danielsen

This thread is closed