Effectlets events

Following Herd's comment about missing feedback, here we are, talking about Effectlets development :) AFAIK an Avedesk Effectlet is able to receive the following events:

  • Sub OnCreate()
  • Sub OnMouseOn()
  • Sub OnMouseOut()
  • Function OnBeforeDraw(IsMouseOn, IsSelected, IsPreview)
  • Function OnAfterDraw(IsMouseOn, IsSelected, IsPreview)
  • Sub OnSave()
  • Function OnPreferenceChange(Preference, oldValue, newValue)
  • Sub OnTimer()
  • Sub OnSelect()
  • Sub OnDeselect()
  • Sub OnShow()
  • Sub OnHide()
  • Sub OnConfigure()
  • Sub OnStartMove()
  • Sub OnEndMove()
  • Sub OnLeftClick()
  • Sub OnRightClick()
  • Sub OnDestroy

I found the list in one of the example effectlet coming with AD :)

write down your comments and ideas !

#292325

about the On*Click events, I'd love the option to "stop" the event from reaching the desklet: e.g. right click - if I right on a desklet, its menu pops up... but if I want the Effectlet to handle the click, without menus coming in the way, I have to disable right-click on the desklet... but this way, the click is disabled for the effectlet too :slant:

So it would be nice to have either one of the these features:

  • a boolean return value for the On*Click events, to forward or stop the click-event
  • disabling left/right click on the desklet does not prevent the event from being delievered to the effectlet

(yeah, my english is horrible... I'll try to write it better... later :P)

#292326

Its no problem to turn the Subs into a function. The current effectlets would return False, only newer ones would have the opportunity to return True indicating that they want to "eat" the event.

As for disabling - we'll see. Normally I'd presume that the effectlet needs to know the status bits before it can put those clicks to use, but I am no despot...

PS: I asked Unbe to move this thread back into the AveDesk subforum - didnt seem the right place even though its development related...

#292408

The problem with an effectlet stopping a certain event to reach the desklet, would be that it's highly confusing: suppose one effectlet stops rightclicking to reach the desklet as you want, how would the user access the rightclick menu then?

Or, even more confusing, what if a desklets `eats` the OnSelect -event? Should the desklet be selected, should the previous selection be restored? etc...

it's an interesting idea to let effects / effectlets have different side-effect than those graphically, for which I intended them in the first place. I think this idea, needs only a bit more thought :)

#292412

As for disabling - we'll see. Normally I'd presume that the effectlet needs to know the status bits before it can put those clicks to use, but I am no despot...
well... I think the sub/function conversion is better, if it can be done without backward compatibility issues. The second option was there as... a second option :)

@Andreas

only the Click events should be "edible"... Selection is a desklet status, that's ok as a simple event :)

Adding side-effects through effectlets is useful because it is easier than re-writing a desklet to add a simple feature but somehow... yes, is a hack. One should not write a Cornerspot Effectlet but a Cornerspot Desklet and you could apply normal graphical effectlets to it (like Alpha, Slide, Fade, Rotation, or Magnification or the ones coming with AD). The problem is: at the moment, it's easier to write an effectlet than a desklet... an easy-scriptable desklet would help :P (haven't tried Sysstat - it does not work at all on my computer)

#292506

another idea: I was thinking about a distribuited arrangement effectlet... I apply it to more than a desklet, and they tell each other their position and lay out accordingly on... a grid, a circle, a line :) but this needs inter-effectlet communication...

and could you fix the sliders in the preferences panel showing the leftmost value if the range starts from a negative number ? (see slide effectlet preferences)

#292507

A cross effectlet communication is possible. You'll need to wrap parts of your effectlet in a vbScript class (yes, I know) and assign it with Set Desklet.Tag = Me. Other effectlet instances now can enumerate the running desklets and access the methods of your effectlet class by the Desklet.Tag property, presumably conservative approach in the lines of ...If TypeName(Me) = TypeName(Otherdesklet.Tag) Then...

I'm looking at the slider...

edit:

Having looked at the slider: It seems to jump to 0 if clicked the first time. Was it that?

Currently sliders only support integers. The jumpiness occurs because of jumping to the next integer value.

You're using sliders to distinguish between 0 and 1?

Use "Boolean" instead of "Slider". Will give you a nice checkbox.

Funnily you will need to force a conversion since the property returns "True" or "False"

If (State = 1) And (CBool(StopOnMouseOut) = True) Then...

#292511

A cross effectlet communication is possible
:D love it ! going to try it tonight
I'm looking at the slider...
the problem is with negative/positive ranges (-X .. +X): when the preference dialog is shown, the slider is at the leftmost position, even if it's value is somewhere in the middle. You can see an example in the Slide Effectlet, for the Vertical/Horizontal Movement settings, that range from -200 to +200. We talked about this from the second post here.
You're using sliders to distinguish between 0 and 1?
Ehm, yes ;) It looked better IMO, some kind of "coherence" between settings

#292517

:D love it ! going to try it tonight

mmmh... Avedesk says the Desklet.Tag property does not exist... :slant:

#292699

DIM ad 'As AveDesk

set ad = CreateObject("AveDesk.Application")

for each desklet in ad.RunningDesklets

desklet.Tag = 1

msgbox cstr(desklet.Tag)

next

This works happily here.. try to close avedesk and run unregister.bat.

#292700

I've tried unregistering... I'm using this two lines in an effectlet:

 Sub OnCreate()

Set obj = New dnEffect

Set Desklet.Tag = obj

[...]

End Sub

can't really understand what's wrong :)

#292701

Can you send me all the stuff? I can break into the avedesk source code with a debugger to see what's going on ;-)

#292702

here it is http://dreadnaut.altervista.org/test/test.html

[edit] man, I need to sleep :) I'll go on tomorrow !

#292703

Desklet.Tag is a VARIANT type. Only object-types need to be set'ed in VBScript. Effectively,

 Sub OnCreate()

Set obj = New dnEffect

Desklet.Tag = obj

[...]

End Sub

The Desklet has a VARIANT memberfield named Tag. The variant is always there, thus you need to assign it, not set it.

I hope this is all correct, I am no COM/VBScript guru like herd. I hope he can confirm this stuff when he's back from his metal-party.

#292709

ok, that's working, thanks! now the problem is when I try to read the Tag... I really don't understand the logic in this vbscript :P

 (inside a class method)

Dim eff



For Each desklet In ad.RunningDesklets

eff = desklet.Tag

[...]

Next

both eff and Tag are variant, isn't it ? well, with or without set, I get a "Class does not support automation: desklet.Tag" error... WTF ?

#293531