DX Script.

Need a little help creating a function.

Thursday, December 4, 2008 by Lumic | Discussion: Help

Hey WC,

I have been using a generic docking / autohide script, and its autohide state causes problems in my upcoming theme. The theme has docking objects with children, but the children need to use "MouseEnter" & "MouseLeave" subs. However, this screws up the autohide section of the docking object script, which uses "MouseLeaveEx"

Since the scripts interrupt each other, is there any other way I can script "Object_OnMouseEnter" / "Object_OnMouseLeave" subs / functions without using those?



I tried this, and it didn't work:


'Script for object "Activator", "Activator2", "Activator3", etc.

Object_OnStateChange (state)

If state = "Mouse over" Then

DesktopX.ScriptObject("Example").FadeIn

Else state = "Mouse down" Then

DesktopX.ScriptObject("Example").FadeIn

Else

DesktopX.ScriptObject("Example").FadeOut



The object "Example" has 2 functions. "FadeIn" realigns the object "Example", kills the timer used in "FadeOut" & activates a timer that increases opacity. "FadeOut" kills the timer used in "FadeIn" & activates a timer that decreases opacity.

The object "Example", when object "Activator" is 'mouse overed', fades in but then automatically fades out.



I see the problem here as that the other scripts (i.e. with objects "Activator2", etc.) are contradicting each other (the 'Mouse awayed' objects want to hide "Example" while the 'Moused overed' one wants to show it). Correct me if I'm wrong. What I am saying is using "StateChange" the way I did can only work for 1 child object.

If the above is not clear I can upload my situation again in my personal gallery.

If someone could give me an idea on how to work this, it would be great. (Either changing the generic docking script / the 'activator' script)

Thanks, Ryan (ST)
Tiggz
Reply #1 Thursday, December 4, 2008 5:10 PM

I don't understand why you need scripts in the children objects.

 

The whole point of using Object_OnMouseEnterEx(objname) is that it receives events from the object itself and all it's children.

 

Inside the sub you can use If...then statements or Select...Case statements to determine which object you are dealing with and act accordingly.

 

Or have I misunderstood the situation?

Lumic
Reply #2 Friday, December 5, 2008 9:29 AM

The scripts for the children objects are used for other purposes, i.e. labels

I am creating a kind of dock in DX, as an alternative to the standard drag & drop containers, which I find rather messy.

The "MouseEnter" & "MouseLeave" on children control the label's visibility.

Tiggz
Reply #3 Wednesday, December 10, 2008 5:06 AM

I would definitely look into migrating the children's scripts to the main parent script - it gives you much more control over what is going on, and centralizes the script which helps you keep things organized.

 

Example code:

Code: vbscript
  1. Sub Object_OnMouseEnterEx(objname)
  2.    If objname = object.name then
  3.       'event fired by mousing over the main object
  4.       Call Fadein
  5.    Elseif objname = "child1" then
  6.      'event fired by mousing over "child1"
  7.       desktopx.object("child1label").visible = true
  8.    End If
  9. End Sub
Lumic
Reply #4 Wednesday, December 10, 2008 8:46 PM

Thanks Tiggz! I did it another way, but I will use your method in the future as it seems much more stable.

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