Timing problem

G

Graham Stevenson

Hi,

I am trying to do an auto-save on user changes with various controls
on a number of tab pages.

The problem I have is that I am using the 'Leave' event for the tab to
trigger the save function.

What happens is that when I click on another part of the screen (ie
external to the tabs - its actually a TreeView), that part sends an
event to 'reload' the data in the tabs with the 'detail' for the newly
selected item, and this event comes in BEFORE the tab leaving event
!!. Hence my changes get 'lost'.

What is the best place to put auto-save code ???. I don't really want
every keystroke (ie textbox changed event etc.) to write to y
database. I have tried using the 'validating' events of the various
controls, but this seems to fire even later than the tab leave event
:-((.

It did seem to me that I should expect a 'tab leave' event immediately
the user clicks anywhere off the tab, but this is not so.

Thanks

Graham
 
B

Brandon Owensby

You do have an interesting problem. You might wanna try using the act of
clicking on the control that changes the data do a save. That way it does a
save just prior to doing the load of new data. You can then decide what
other events you need to also watch for to do a save. If this doesn't cover
all the bases you may need to override your tab control or at least the tab
page. I'll let you know if I come up with anything else. Let me know if you
have any other problems.

Brandon
 
P

Praveen Ramesh

Graham,

What about the good old Validating event of the tab? I would think that
should get fired before the tree's selectionchanged event (or whatever).
Doesn't it?

Regards,
Praveen Ramesh
Syncfusion, Inc.
visit www.syncfusion.com for .Net Essentials
 
S

Sachi

Hi Brandon Owensby, Can you reply me off the list?
(e-mail address removed)
Would like to discuss about datagrid.

Thanks and Regards,
Sachi
 
G

Graham Stevenson

Brandon,

Thanks for the response. 'Interesting problem' in one description ;-)
- 'Pain in the ***' is closer to the truth ;-).

My guess (without trying this) is that the tab validating will also
appear too late (just like its child controls).

The problem with using the control being clicked on is that its on a
completely different part of the screen - different object hierarchy
etc. The screen is split into different areas of functionality and I
use events to communicate between them all.

Having let the problem 'fester' in the back-brain for a while (and as
MS haven't made a beter suggestion), I think I'm, going to have to
revert to the old dirty page trick. Set a 'dirty' flag on every child
control change event, then whenever the tab gets a reload command (or
when I leave the tab of course), do a save if the flag is set. I had
thought that the 'validating' functionality would have overcome this
need. Such a pity as the validating mechanism seemed like the ideal
place :-((.

Graham
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top