... neither do other subs
Published on May 12, 2005 By Fix In 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 !

Comments
on May 12, 2005
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.
on May 12, 2005
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
on May 12, 2005
Of course, you have to add the check for what object calls the event.
on May 12, 2005
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.
on May 12, 2005
Ah, yes it does exist. Even in the documentation. Hm.. Didn't notice that.
on May 12, 2005
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.
on May 12, 2005
Wow, thank you very much thomassen. At least you've learnt something too
on May 12, 2005
hehe
Yes, I did.