scripting onclick & object type

Hi,
I am making objects wich i want to change by an external .vbs file which I use as a config file -> it contains an array with url's and titles wich i put on my objects.

this works very nice but...

for some other objects I would like to be able to change the object type
and for some other I would like to add extra actions with there onclick behaviour...

Is there anyway to do this?? I can't find it in the doc... (perhaps i don't look good engouh ;) )

Thanks for helping me out!!!
7,507 views 13 replies
Reply #1 Top
im not sure i understand what it is your wanting to change.

Reply #2 Top
i'll try explane it better:
there's like a main menu on my desktop & several submenu's
instead of cloning the same menu each time, the script looks up in an external file what the behavior of the objects in the submenu must be...

this works fine, but for some objects I would like to control it's onclick behaviour & it's type (object controller or shortcut)

I only found doc on mouseenter mouseleave statechange... didn't saw anything about the for example in VBA known OnClick event

Is this more clear??

Reply #3 Top
If you mean the Object Type: Shortcut - Folders menu. That can't be scripted.

For onclick look under Object Callbacks.
Function Object_OnLButtonDown(x, y),
Function Object_OnRButtonDown(x, y),
Function Object_OnLButtonUp(x, y, Dragged),
Function Object_OnRButtonUp(x, y, Dragged)
Reply #4 Top
Perhaps create several, invisible template objects, one configured as a shortcut, one a layer, one a URL etc, then use these as templates for cloning.

I don't think you need object controllers as you can do what they do using script.
Reply #5 Top
Thanks guys!

If like SirSmiley says the Object Type can't be scripted , I'll need Tiggz work-a-round... altough it's less neath... Perhaps something for a next desktopx version??

I'm going to try it all out right now!

Reply #6 Top
Hi

I think I can see where your headed for.I would use hidden objects to add these variables,Then use on mouse up messages to call whatever variable I wanted to use.

(Button 1) wants to hide (group a) and show (group b)and other objects also wish to also.

So create (hidden object 1)It's set to hide (group a)as an object controller and


create (hidden object 2)It's set to hide (group b)as an object controller then send a

(Mouse up) message from (Buttun 1) to the hidden object or use any other object to

send from.

This way one object can do many things yet each called object does it's own thing.




Reply #7 Top
Hey again,

I just ran into another problem; might be caused by migh programming skills so it's probably a stupid question...

can we set the Object_OnLeftButtonDown(x,y) function from an object through an external script?

so for example in the script of object1 changing what's in object2 OnLeftButtonDown function...

Thanks again!
Reply #8 Top
Yes, just tried it. This snippet is being called from an object named "test" and moves the second object Left by 25px every time "test" is clicked. I stick to using Up instead of down in case I have animations, etc.

Code: vbscript
  1. Function Object_OnLButtonUp(x, y, dragged)
  2. If not dragged then
  3. DesktopX.Object("test2").Left=DesktopX.Object("test2").Left+25
  4. End If
  5. End Function


If you want to try something like Tiggz suggested then here's a thread similar to that.
Scripting a Popup Shortcut
Reply #9 Top
Seems to be that i wasn't clear enough; what you are telking about i allready have in the script...

i would like to go one level deeper into that...

let me explane following your example:

with object "a" "b" & "c" I want to define what will happen when i click on object "test" ex: a moves test2 +25 b -25 and c +100 to the top instead...

I am afraid I am running into the limits of the program, I am used to make web-based stuff on this way with java, DOM and/or php...
Reply #10 Top
Seems to be that i wasn't clear enough; what you are telking about i allready have in the script...

i would like to go one level deeper into that...

let me explane following your example:

with object "a" "b" & "c" I want to define what will happen when i click on object "test" ex: a moves test2 +25 b -25 and c +100 to the top instead...

I am afraid I am running into the limits of the program, I am used to make web-based stuff on this way with java, DOM and/or php...
Reply #11 Top
Is this what you mean?

Create four objects named : objMain, objA, objB, objC

I referenced the external script from objMain and all other objects were child objects with parent set as objMain and child status set to No. This is a vbscript but, as long as it is well formed should work as a text file.

This script moves them from their current screen positions:
Code: vbscript
  1. Dim oMain : Set oMain = DesktopX.Object("objMain")
  2. Dim A : Set A = DesktopX.Object("objA")
  3. Dim B : Set B = DesktopX.Object("objB")
  4. Dim C : Set C = DesktopX.Object("objC")
  5. Function Object_OnLButtonUp(x, y, dragged)
  6. If not dragged then
  7. Call MoveObjects
  8. End If
  9. End Function
  10. Sub MoveObjects
  11. A.Left = A.Left+25
  12. B.Left = B.Left-25
  13. C.Top = C.Top-100 ' Moves toward the top
  14. ' The Below Code moves the objects to specific screen positions
  15. 'A.Left = +25
  16. 'B.Left = -25
  17. 'C.Top = +100
  18. End Sub
Reply #12 Top
No ... im afraid it isn't possible; I wanted to centralize all the scripting
So that on loading desktopx all settings would be written to the objects...

Desktopx is to limited for me I think...

Now i am trying to change the parent of en object... doesn't get it working neather...
-> I made multiple buttons and a little text which should show up on mouseover... so one extra object must be enough in theory...

Thanks for trying to understabd me ;-)
Reply #13 Top
You can't write scripts to the objects directly but, you could use an include statement in a base object(for cloning) then create an external script file for each new object.
That could be called by referencing a variable to an ini file or the Object.Comments field.

Scripting can be centralized to one main script all the objects just need to be child objects. Also, you can script parent child relationships.

If you want drop me a download link via pm or email my the object(s) and I'll have a look at it. My email's at my user page.