Fandom

Scratchpad

Segments: Hints and Tips

215,988pages on
this wiki
Add New Page
Discuss this page0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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"
 value1=20
End Sub

Object 2

Sub Object_OnLButtonUp(x,y,dragged)
 value2 = DesktopX.ScriptObject("object1").value1     'this is the DesktopX.ScriptObject usage
 MsgBox(value2)
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