Object States
Tuesday, March 25, 2008 by p e d | Discussion: DesktopX
Hi Guys,
Quick question.
Is it possible to loop thru an objects states similar to
For Each obj In DesktopX.Objects
Next
or any other way?
Thanks
Reply #2 Tuesday, April 8, 2008 6:39 AM
For Each obj In DesktopX.Objects
Select Case obj.name
Case "name1"
It obj.state = "state1" Then obj.state = "state2" Else obj.state = "state3"
Case "name2"
Select Case obj.state
Case "state1" '<== do something
Case "state2" '<== do something
Case "state3" '<== do something
etc...
End Select
End Select
Next
Reply #3 Monday, May 5, 2008 7:25 AM
You can use Object.States("").property to set a value for all states of an object however.
There is also the possible complex method of accessing the theme.ini (theme2.ini?) in the Object.Directory folder and parsing it to get the states of an object. But that would not pick up any states that have been added since last save.
And probably wouldn't work for any packaged themes and gadgets etc.
This is something I dont think will have a 'workaround' solution unless it's put directly into DesktopX function.
Could be wrong.
Reply #4 Monday, May 5, 2008 2:24 PM
Here's what I did. On a simple image object I created five states named "state1"(up to 5).
Then I looped through them to verify if they existed. Obviously, you must likely would put this data into an array after running the sub or function.
- Sub Object_OnScriptEnter
- Call IterateStates
- End Sub
- Sub IterateStates
- sActiveState=Object.State
- For x=1 To 5
- strState="state"&x
- 'x=Object.State(strState)
- If Object.States(strState).Picture "" Then
- If sActiveState=strState Then
- oList=oList&"Active: "&strState&vbnewline
- Else
- oList=oList&strState &vbnewline
- End If
- End If
- Next
- msgbox oList
- End Sub
Reply #5 Wednesday, May 7, 2008 6:19 AM
A powerful point behind a collection is that you don't necessarily know what it contains.
One thing which would tell you if an object has a state or not is if DesktopX threw an error if the state didn't exist. BUT I DON"T want that, because I use this non error response to allow me to do many things in my creations, and there is no real use to having DesktopX chuck a fit if the state isn't there.
A states collection for an object would be fine.
Where we can:
For each objState in Object.States
MsgBox("Found state: "&objState.Name
Next
or something, like we can for children and group objects.
Reply #6 Wednesday, May 7, 2008 8:49 AM
I just noticed if i look at the ABOUT screen, (in pro) i no longer see a detailed version number.. or ANY #.. is it just me?
Reply #7 Tuesday, May 13, 2008 8:20 AM
Sorry but I got a number.
but if it makes you feel any better my screen went dead on sign in from a bad pool header lol.Thats life always something going on.
Reply #8 Friday, May 23, 2008 1:12 AM
Guess I'll leave that part out of my desktop for now.
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!







Reply #1 Tuesday, April 8, 2008 6:18 AM
I've never tried it personally.But, I can tell you this,each object has, two, shall I say parts,the scipting section is written to separately.I think that might be a good way to put it.
In other words I would define all the states in the scripting section if I needed DX
to pick up on them.
Sorry I'm not better at codeing.
Eddie