Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SelectedRow/SelectedItem don' t invoke SelectionChanging

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
flc.net



Joined: 21 Jun 2005
Posts: 89
Location: Switzerland

PostPosted: Mon Aug 29, 2005 7:28 am    Post subject: SelectedRow/SelectedItem don' t invoke SelectionChanging Reply with quote

Hello Support

I think this is a Bug: Selecting a Row/Item with the Methods SelectedRow/SelectedItem only invokes the Event SelectionChanged but not the Event SelectionChanging.

Best Regards
Giuseppe
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Aug 29, 2005 9:51 am    Post subject: Reply with quote

I'm not sure that this really is a bug. The selection changing event is fired by VirtualTree when the user interactively attempts to make changes that will affect the selection of the tree. It is not fired in response to a change in the SelectedRows collection (as SelectionChanged is). It's intent was to allow you to prevent the user selecting something that you don't want allow them to - or to warn them if they are about to do something that may take some time (eg selecting 1 million rows). If you are setting the selection programatically then presumably you know the selection rules and so it shouldn't be an issue.

Anyway let us know what you thoughts are and why you think it should fire SelectionChanging in this case.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
flc.net



Joined: 21 Jun 2005
Posts: 89
Location: Switzerland

PostPosted: Mon Aug 29, 2005 10:42 am    Post subject: Reply with quote

Infralution wrote:
Anyway let us know what you thoughts are and why you think it should fire SelectionChanging in this case.


I thought it would be the same behaviour like Microsoft implementation: e.g. If you call myForm.Close() both Closing and Closed are invoked.

I have implemented an generic "AutoUpdate". If a User edits the Data in Row 0 and then jumps to Row 1 data from Row 0 will be updated on the Database.
I use the SelectionChanged Event to know when the User leaves the Row and the SelectionChanging Event to know which Row they have edited (through SelectionChangingEventArgs).

With the CheckBox as a PrefixColumn, I set the SelectedRow via Code when a User checks the Box.... and because the SelectionChanging Event is not fired i don't know which row was selected before.

I can implement my behaviour in another way so it's OK when SelectedRow/SelectedItem does not invoke the Changing event.

Thanks and Best Regards
Giuseppe
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Aug 29, 2005 11:10 am    Post subject: Reply with quote

Actually I find the form.Closing behaviour a bit irritating. If you want to prevent the user closing the form using the form close cross you handle the Closing event and set the cancel flag - but then you get the event firing when you programmatically close the form - so you have to set some member variable so that in the Closing event you know that you really want to close this time. I'm fairly sure this was different in VB6.

Anyway we will put some more thought into the issue. If you want to auto update the database why not just do it from the SetCellValue event (ie whenever a cell value is changed)? If you use the Validated event as CellEditor UpdateValueEvent (which is the default) then typically this is only fired as the user changes selection anyway.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group