StrataFrame Forum

SetDefaultValues changing the CurrentRowIndex

http://forum.strataframe.net/Topic21395.aspx

By Andria Jensen - 1/5/2009

In my SetDefaultValues event handler in my business object, I am seeing the CurrentRowIndex change as soon as a field value is set in the SetDefaultValues handler.  In my case I have no sorting applied or filtering -- the Sort and Filter properties are both blank.  The scenario is that I have my business object used as a grid data source via a BBS, but I even tried clearing the grid sorting/filtering before adding a new row just to see if that was the cause.  I am seeing this across my application, and it appears to have just popped up since I upgraded to the beta version that Trent gave me of 1.6.7. 

What I have is code like this:

Private Sub HolidaysBO_SetDefaultValues
  Me.Date = Today
End Sub

I can set a breakpoint on the assignment line, and before the assignment the CurrentRowIndex is the newly added row.  As soon as the assignment is made and I step through the line of code, the CurrentRowIndex changes.  To go further, the EditingState is Idle when it should be Adding.  This was all working as designed until my upgrade, so I'm wondering if this is perhaps a bug?

By Andria Jensen - 1/5/2009

Just to add to this a little bit, the EditingState does not change to Idle -- rather, it is in Idle EditingState when it enters the SetDefaultValues handler code.  It should be in Adding state at this point.  Also, the index that it is changing back to upon field assignment is the focused index when the add takes place.  So, whatever item I had selected in the list when pressing the add button is the one it goes back to upon the default value assignment statement.
By Andria Jensen - 1/5/2009

I have created a sample project to speed this along.  If you click the add button, it does not clear out the values and go to a new row.  Instead it goes back to the selected row.  If you go to the code and clear out the value being assigned in the SetDefaultValues event handler, all works as expected.
By Trent L. Taylor - 1/6/2009

I am in the middle of building and update and posting the next beta which will fix this issue.  There was no issue in regards to the EditingState.  The state doesn't get changed until AFTER the new row is added (which includes the defaults getting set).  So no issue there.  However, there was an issue with the currency manager position being out of sync.  This issue has been resolved and will be in the Posted Releases section later this morning.
By Andria Jensen - 1/6/2009

Thanks!  That appears to have fixed the problems I was having. 
By Trent L. Taylor - 1/7/2009

Cool Cool