Segments: Hints and Tips

213,128pages on
this wiki
Add New Page
Add New Page Discuss this page0

Allowing a right click action without the default DesktopX object menu appearing.

To prevent the default menu behaviour of DesktopX when you right click an object insert the command Object_OnRButtonUp = True into the Object_OnRButtonUp(x,y,dragged) function.

Function Object_OnRButtonUp(x,y,dragged)
 Object_OnRButtonUp = True
End Function

You can capture the right clicks of all children of an object by using the Object_OnRButtonUpEx(obj,x,y,dragged) command.

Function Object_OnRButtonUpEx(obj,x,y,dragged)
 Object_OnRButtonUpEx = True
End Function
  • Whatever commands you place in the right click function will become the only response to a right click on the object.
  • Note that this will also disable the DesktopX Builder right click menu for the objects you place it in.

Accessing script variables in an object from another object

To allow other objects to see a variable in another objects script, declare (Dim) the variable outside of all functions and subroutines. You then use the DesktopX.ScriptObject command to access the variable.

Object 1

Dim value1     'this is what I mean by declaring the variable outside of any Sub or Function
               'Dimming a variable in this way makes it accessible from all Sub's and Functions in a script
               'as well as to other objects.

Sub Object_OnScriptEnter
 Object.Name = "object1"
End Sub

Object 2

Sub Object_OnLButtonUp(x,y,dragged)
 value2 = DesktopX.ScriptObject("object1").value1     'this is the DesktopX.ScriptObject usage
End Sub

If you place the above respective scripts into two new desktopX objects, then click the second one, a message box should appear containing the text "20". This value has been read by object2 from the script-space of object1.

Also on Fandom

Random wikia