DX Script : How to access variable of another object

Friday, October 21, 2005 by cyril_lemerle | Discussion: DesktopX Wishlist

Hi all,

I'm going through some issue while building independent objects. And my biggest issue is to access variable (public or not) defined in the script of an object from an external object.

For example:
I'm building a simple scrollbar where I defined a variable called "progress".
My variable is updated whenever onMove happens, blablabla ... Anyway...

How do I access this "progress" variable from another object ? (ie: vitesse parameter)

How do I do that with group ?
My progress bar is a group of 2 objects. How can I access the variable defined in the group and not defined in any specific object in the group ? This group is consistent entity that is a unique interface for a better modularity.

I didnt check the concept of controller.
Can a controller help me ? if yes, how does it work ?

Thanks
Cyril
rabidrobot
Reply #1 Friday, October 21, 2005 7:53 PM
I don't think you'll need a controller. And trying to get a single variable that may or may not be defined in a member of a group sounds like it wouldn't work, but maybe I don't understand that part.

Anyway, if the variable is Dim-med outside of any subs in an object's script, then it can be accessed.

DesktopX.ScriptObject("TheObjectWhoseScriptDefinesTheVariable").variablename
thomassen
Reply #2 Saturday, October 22, 2005 8:23 AM
I thought you had to declare the variable with the Public keyword.
like this: Public myVar
and then you'd be able to access it like DesktopX.ScriptObject("someObject").myVar
MountainDragon
Reply #3 Saturday, October 22, 2005 9:47 AM
I believe it defaults to Public if it is defined outside of a Sub or Function.
thomassen
Reply #4 Sunday, October 23, 2005 6:29 AM
Ah. I think I've never tried it. Does the same happend in Visual Basic?

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