Object_OnMouseEnterEx sub doesn't work...

... neither do other subs

Thursday, May 12, 2005 by Fix | Discussion: DesktopX

Hello !
I've created several objects. One of them contains a script that should control all the other objects. The name of the other objects is "Update_1", "Update_2", "Update_3", etc.
The following script just doesn't do anything, and I can't understand why :

'OnMouseEnter subs
Sub Object_OnMouseEnterEx(Obj)
If InStr(Obj.Name,"Update") <> 0 Then
ObjNum = Right(Obj.Name,1)
If DesktopX.Object("Update_" & ObjNum) = "away" Then
DesktopX.Object("Update_" & ObjNum).State = "over"
SetUpdateFrequencyText(ObjNum)
End If
End If
End Sub

If you want to help me and download these little objects, please click here : http://www.contedefaits.com/Web_Objects.desktop and you'll see that nothing happens when you mouse over / mouse away / click on any of the little black bars on the desktop (they should normally set the update frequency of the object).

Thank you very much in advance, and have a good day everyone !
Fix
Reply #1 Thursday, May 12, 2005 4:56 AM
Sorry, please read :
If DesktopX.Object("Update_" & ObjNum).State = "away" Then
etc...

By the way, shouldn't DesktopX.Object("Obj.Name).State = "away" work too ? Or simply Obj.State ?
I've tried all I can think of, but nothing works... Please help me !
Thanx.
thomassen
Reply #2 Thursday, May 12, 2005 11:24 AM
The reason why it doesn't work is because there is not event availibe in DX for that. Yes I know, annoying isn't it?

But the workaround isn't all that bad or hard:

Sub Object_OnStateChangeEx(state)
    If state = "Mouse over" Then
        'Mouse over code here
    End If
End Sub
thomassen
Reply #3 Thursday, May 12, 2005 11:50 AM
Of course, you have to add the check for what object calls the event.
Fix
Reply #4 Thursday, May 12, 2005 12:48 PM
Sorry but I don't understand what you mean : since DX 3.0, the Sub Object_OnMouseEnterEx(Obj) exists (event if it's not documented yet). For example, Tiggz (I'm a faaaaaaaaaan, but he, I'm not the only one, right ?) uses it in his last OMNI objects (dual weather, for example).
So what am I doing wrong ?
Thanx very much.
thomassen
Reply #5 Thursday, May 12, 2005 1:23 PM
Ah, yes it does exist. Even in the documentation. Hm.. Didn't notice that.
thomassen
Reply #6 Thursday, May 12, 2005 1:30 PM
Right, I had a look at your object. The reason why nothing happends is that the *Ex function gets tha messages from the child objects of the objects containing the script.
In your widget you got an object named "scripts" to handle the scripting. However, none of your other objects passess any messages on to the "scripts" object because none of them is set as child to it. Select your other object, right-click, go "Set Parent" then select "scripts". Then everything starts to come to life.
Fix
Reply #7 Thursday, May 12, 2005 4:34 PM
Wow, thank you very much thomassen. At least you've learnt something too
thomassen
Reply #8 Thursday, May 12, 2005 5:16 PM
hehe
Yes, I did.

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01