Smaky Posted May 31, 2009 Report Share Posted May 31, 2009 Does anyone of you docklet developers know how to detect that your docklet is being removed from the dock under ObjectDock/ObjectDock+? I have seen that OnDestoy gets called either when the docklet is being unloaded from memory because of a dock shutdown or when the docklet is being destroyed because it was deleted from the dock... but how to distinguish among them? Link to comment
BOBAH13 Posted June 1, 2009 Report Share Posted June 1, 2009 When your docklet is being created, you can write your settings into ini file. So, may be it's possible, when your docklet is being destroyed, you can check if your value of settings exists or not, and if not, then your docklet is being deleted. But it depends on the dock which uses your docklet. But you should try to do it Link to comment
Smaky Posted June 1, 2009 Author Report Share Posted June 1, 2009 The thing is that in ObjectDock, OnDestroy is used to write all configuration settings back to the Dock configuration file... so If I do write something to an INI file upon OnCreate it always be there... so again there will be no way to distinguish between a Dock Shutdown and a docklet deletion. Link to comment
matonga Posted June 4, 2009 Report Share Posted June 4, 2009 Mmm... as far as I know, OnSave is used to write all configuration, not OnDestroy. Maybe then it's a matter of checking if OnSave was called before, when OnDestroy gets called. But I dunno if OnSave is called on user removal too (that would be useless, but, who knows). Link to comment
Smaky Posted June 5, 2009 Author Report Share Posted June 5, 2009 (edited) @matonga,You're absolutely right! I must have been sleepy or something... or who knows... maybe I just have lost way too many neurons lately.OnDestroy gets called wheter the docklet is deleted or the dock is being shutdown... I'm not sure about OnSave, my guess is that it is not called when the docklet is deleted. But that's easy to verify. If so, as you suggest there is a way to differenciate between those two event. I'll keep my fingers crossed.Edit: Well, yes, OnSave is not being called whenever the docklet is being removed from the dock, whereas it is called when the dock is being shutdown. So it seems that this is the way to go. But it is not that simple, since OnSave is called on other ocassions too (I found that if you open the options dialog for the dock, upon closing, OnSave gets called) so, a simple flag would not suffice.Thanks (yet) again. Edited June 5, 2009 by Smaky Link to comment
Smaky Posted June 6, 2009 Author Report Share Posted June 6, 2009 (edited) That could work. yes. It worked just fine... needs a bit more testing though. Thanks for the idea. Edited June 6, 2009 by Smaky Link to comment
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now