Aqua-Soft Forums: How To Detect A Docklet Is Being Removed - Aqua-Soft Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Detect A Docklet Is Being Removed Rate Topic: -----

#1 User is offline   Smaky Icon

  • Group: Member
  • Posts: 586
  • Joined: 19-April 08

Posted 31 May 2009 - 03:24 AM

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?
0

#2 User is offline   BOBAH13 Icon

  • Group: Developers
  • Posts: 465
  • Joined: 06-September 08

Posted 01 June 2009 - 04:10 AM

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 :)
0

#3 User is offline   Smaky Icon

  • Group: Member
  • Posts: 586
  • Joined: 19-April 08

Posted 01 June 2009 - 03:21 PM

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.
0

#4 User is offline   matonga Icon

  • Group: Developers
  • Posts: 1,286
  • Joined: 04-September 06

Posted 04 June 2009 - 09:09 PM

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).
0

#5 User is offline   Smaky Icon

  • Group: Member
  • Posts: 586
  • Joined: 19-April 08

Posted 05 June 2009 - 03:32 PM

@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.

This post has been edited by Smaky: 05 June 2009 - 03:50 PM

0

#6 User is offline   matonga Icon

  • Group: Developers
  • Posts: 1,286
  • Joined: 04-September 06

Posted 05 June 2009 - 05:00 PM

flag + timeout?
0

#7 User is offline   Smaky Icon

  • Group: Member
  • Posts: 586
  • Joined: 19-April 08

Posted 06 June 2009 - 02:48 AM

That could work. yes. It worked just fine... needs a bit more testing though. Thanks for the idea.

This post has been edited by Smaky: 06 June 2009 - 06:13 AM

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic