Difference between revisions of "Cursors"

From Xojo Documentation

m (See Also)
 
Line 9: Line 9:
  
 
<dynamicTable id="Methods" class="methodTable" title="Methods" columns="2">
 
<dynamicTable id="Methods" class="methodTable" title="Methods" columns="2">
{{Method | name=Hide| prefix=Cursors | newinversion=2006r2 | description=Hide()&#x0A;Hides the cursor.  }}
+
{{Method | name=Hide| prefix=Cursors | newinversion=2006r2 | description=Hide()&#10;Hides the cursor.  }}
{{Method | name=Show| prefix=Cursors | newinversion=2006r2 | description=Show()&#x0A;Shows the cursor.  }}
+
{{Method | name=Show| prefix=Cursors | newinversion=2006r2 | description=Show()&#10;Shows the cursor.  }}
 
</dynamicTable>
 
</dynamicTable>
  
Line 16: Line 16:
 
The '''Cursors''' module contains a library of standard mouse cursors that you can access by calling [[System]].'''Cursors'''.''MouseCursorName'', where ''MouseCursorName'' is one of the following:
 
The '''Cursors''' module contains a library of standard mouse cursors that you can access by calling [[System]].'''Cursors'''.''MouseCursorName'', where ''MouseCursorName'' is one of the following:
 
{| class="genericTable"
 
{| class="genericTable"
 
 
! width=25% | MouseCursorName
 
! width=25% | MouseCursorName
 
 
! width=55% | Description
 
! width=55% | Description
 
|-
 
|-
 
|ArrowAllDirections
 
|ArrowAllDirections
 
 
|A set of four arrows pointing in both the North/South and East/West dimensions. It is typically used when moving objects on Windows.
 
|A set of four arrows pointing in both the North/South and East/West dimensions. It is typically used when moving objects on Windows.
 
 
|-
 
|-
 
|ArrowEastWest
 
|ArrowEastWest
 
 
|A pair of arrows pointing in the East and West directions. It is typically used when resizing something horizontally.
 
|A pair of arrows pointing in the East and West directions. It is typically used when resizing something horizontally.
 
 
|-
 
|-
 
|ArrowNortheastSouthwest
 
|ArrowNortheastSouthwest
 
 
|A pair of arrows pointing Northeast and Southwest directions. It is typically used when resizing something in this diagonal direction.
 
|A pair of arrows pointing Northeast and Southwest directions. It is typically used when resizing something in this diagonal direction.
 
 
|-
 
|-
 
|ArrowNorthSouth
 
|ArrowNorthSouth
 
 
|A pair of arrows pointing North and South. It is typically used when resizing something vertically.
 
|A pair of arrows pointing North and South. It is typically used when resizing something vertically.
 
 
|-
 
|-
 
|ArrowNorthwestSoutheast
 
|ArrowNorthwestSoutheast
 
 
|A pair of arrows pointing in the Northwest and Southeast directions. It is typically used when resizing something in this diagonal direction.
 
|A pair of arrows pointing in the Northwest and Southeast directions. It is typically used when resizing something in this diagonal direction.
 
 
|-
 
|-
 
|Copy
 
|Copy
 
 
|The copy mouse cursor indicates that something is being copied. On macOS it displays an arrow with a "+" icon in it.
 
|The copy mouse cursor indicates that something is being copied. On macOS it displays an arrow with a "+" icon in it.
 
 
|-
 
|-
 
|FingerPointer
 
|FingerPointer
 
 
|This cursor shows one finger pointing up indicating the presence of a hyperlink.
 
|This cursor shows one finger pointing up indicating the presence of a hyperlink.
 
 
|-
 
|-
 
|HandClosed
 
|HandClosed
 
 
|This cursor is typically used in conjunction with the HandOpen cursor to indicate that something has been &ldquo;grabbed&rdquo; and the drag is taking place.
 
|This cursor is typically used in conjunction with the HandOpen cursor to indicate that something has been &ldquo;grabbed&rdquo; and the drag is taking place.
 
 
|-
 
|-
 
|HandOpen
 
|HandOpen
 
 
|This is the open hand cursor that is typically used to indicate that something can be &ldquo;grabbed.&rdquo;
 
|This is the open hand cursor that is typically used to indicate that something can be &ldquo;grabbed.&rdquo;
 
 
|-
 
|-
 
|IBeam
 
|IBeam
 
 
|The text insertion cursor that indicates that text can be entered into the object. Use this in place of the deprecated global function IBeamCursor.
 
|The text insertion cursor that indicates that text can be entered into the object. Use this in place of the deprecated global function IBeamCursor.
 
 
|-
 
|-
 
|InvisibleCursor
 
|InvisibleCursor
 
  <div style="font-style:italic; color:green;">Introduced 2006r2</div>
 
  <div style="font-style:italic; color:green;">Introduced 2006r2</div>
 
|An invisible cursor.
 
|An invisible cursor.
 
 
|-
 
|-
 
|MagnifyLarger
 
|MagnifyLarger
 
  <div style="font-style:italic; color:green;">Introduced 2006r2</div>
 
  <div style="font-style:italic; color:green;">Introduced 2006r2</div>
 
|A magnifying glass cursor with a plus sign in the glass area.
 
|A magnifying glass cursor with a plus sign in the glass area.
 
 
|-
 
|-
 
|MagnifySmaller
 
|MagnifySmaller
 
  <div style="font-style:italic; color:green;">Introduced 2006r2</div>
 
  <div style="font-style:italic; color:green;">Introduced 2006r2</div>
 
|A magnifying glass cursor with a minus sign in the glass area.
 
|A magnifying glass cursor with a minus sign in the glass area.
 
 
|-
 
|-
 
|SplitterEastWest
 
|SplitterEastWest
 
 
|A pair of arrows pointing East and West with a vertical bar between them. This is typically used when dragging a vertical splitter control.
 
|A pair of arrows pointing East and West with a vertical bar between them. This is typically used when dragging a vertical splitter control.
 
 
|-
 
|-
 
|SplitterNorthSouth
 
|SplitterNorthSouth
 
 
|A pair of arrows pointing North and South with a horizontal bar between them. This is typically used when dragging a horizontal splitter control.
 
|A pair of arrows pointing North and South with a horizontal bar between them. This is typically used when dragging a horizontal splitter control.
 
 
|-
 
|-
 
|StandardPointer
 
|StandardPointer
 
 
|The standard system &ldquo;arrow&rdquo; cursor that is used for normal operations. You can use this in place of the deprecated global function ArrowCursor.
 
|The standard system &ldquo;arrow&rdquo; cursor that is used for normal operations. You can use this in place of the deprecated global function ArrowCursor.
 
 
|-
 
|-
 
|Wait
 
|Wait
 
+
|The system "wait" cursor that is used when a long operation is in progress and you cannot provide other feedback. Use this in place of the deprecated global function.
|The system &ldquo;wait&rdquo; cursor that is used when a long operation is in progress and you cannot provide other feedback. Use this in place of the deprecated global function.
 
 
 
 
|-
 
|-
 
|}
 
|}
  
==Examples==
+
== Sample Code ==
The following line in the MouseDown event of a [[Canvas]] changes the cursor to the HandClosed cursor. Returning [[True]] allows the MouseUp event to get called.
+
The following code in the MouseDown event of a [[Canvas]] changes the cursor to the HandClosed cursor. Returning [[True]] allows the MouseUp event to get called.
 
 
 
<rbcode>
 
<rbcode>
 
Me.MouseCursor = System.Cursors.HandClosed
 
Me.MouseCursor = System.Cursors.HandClosed
Line 117: Line 83:
  
 
The following MouseDown event handler for a [[Canvas]] changes the cursor to a Magnifying class if the user presses the mouse button while holding down the Alt key and the Magnify Smaller cursor if the user is holding down the Control key. Return [[True]] so that the MouseUp event is called.
 
The following MouseDown event handler for a [[Canvas]] changes the cursor to a Magnifying class if the user presses the mouse button while holding down the Alt key and the Magnify Smaller cursor if the user is holding down the Control key. Return [[True]] so that the MouseUp event is called.
 
 
<rbcode>
 
<rbcode>
 
If Keyboard.AsyncAltKey Then
 
If Keyboard.AsyncAltKey Then
Line 128: Line 93:
 
</rbcode>
 
</rbcode>
  
The following line in the MouseUp event restores the standard cursor.
+
The following code in the MouseUp event restores the standard cursor.
 
 
 
<rbcode>
 
<rbcode>
 
Me.MouseCursor = System.Cursors.StandardPointer
 
Me.MouseCursor = System.Cursors.StandardPointer
 
</rbcode>
 
</rbcode>
  
The following line in the MouseEnter event hides the cursor.
+
The following code in the MouseEnter event hides the cursor.
 
 
 
<rbcode>
 
<rbcode>
 
System.Cursors.Hide
 
System.Cursors.Hide
 
</rbcode>
 
</rbcode>
  
The following line in the MouseExit event shows the cursor.
+
The following code in the MouseExit event shows the cursor.
 
 
 
<rbcode>
 
<rbcode>
 
System.Cursors.Show
 
System.Cursors.Show
Line 147: Line 109:
  
 
==See Also==
 
==See Also==
[[Application]], [[Control]], [[MouseCursor]], [[System]], [[Window]] classes; [[System]] module.
+
[[Application]], [[Control]], [[MouseCursor]], [[System]], [[Window]] classes; [[System]] module
  
 
[[Category:Language_Modules]]
 
[[Category:Language_Modules]]
 
[[Category:Language_Reference]]
 
[[Category:Language_Reference]]
 
[[Category:Desktop]]
 
[[Category:Desktop]]

Latest revision as of 21:26, 22 January 2019

For web apps, see WebCursors.

Module

Contains a library of standard mouse cursors.

Methods
Hide Show

Notes

The Cursors module contains a library of standard mouse cursors that you can access by calling System.Cursors.MouseCursorName, where MouseCursorName is one of the following:

MouseCursorName Description
ArrowAllDirections A set of four arrows pointing in both the North/South and East/West dimensions. It is typically used when moving objects on Windows.
ArrowEastWest A pair of arrows pointing in the East and West directions. It is typically used when resizing something horizontally.
ArrowNortheastSouthwest A pair of arrows pointing Northeast and Southwest directions. It is typically used when resizing something in this diagonal direction.
ArrowNorthSouth A pair of arrows pointing North and South. It is typically used when resizing something vertically.
ArrowNorthwestSoutheast A pair of arrows pointing in the Northwest and Southeast directions. It is typically used when resizing something in this diagonal direction.
Copy The copy mouse cursor indicates that something is being copied. On macOS it displays an arrow with a "+" icon in it.
FingerPointer This cursor shows one finger pointing up indicating the presence of a hyperlink.
HandClosed This cursor is typically used in conjunction with the HandOpen cursor to indicate that something has been “grabbed” and the drag is taking place.
HandOpen This is the open hand cursor that is typically used to indicate that something can be “grabbed.”
IBeam The text insertion cursor that indicates that text can be entered into the object. Use this in place of the deprecated global function IBeamCursor.
InvisibleCursor
Introduced 2006r2
An invisible cursor.
MagnifyLarger
Introduced 2006r2
A magnifying glass cursor with a plus sign in the glass area.
MagnifySmaller
Introduced 2006r2
A magnifying glass cursor with a minus sign in the glass area.
SplitterEastWest A pair of arrows pointing East and West with a vertical bar between them. This is typically used when dragging a vertical splitter control.
SplitterNorthSouth A pair of arrows pointing North and South with a horizontal bar between them. This is typically used when dragging a horizontal splitter control.
StandardPointer The standard system “arrow” cursor that is used for normal operations. You can use this in place of the deprecated global function ArrowCursor.
Wait The system "wait" cursor that is used when a long operation is in progress and you cannot provide other feedback. Use this in place of the deprecated global function.

Sample Code

The following code in the MouseDown event of a Canvas changes the cursor to the HandClosed cursor. Returning True allows the MouseUp event to get called.

Me.MouseCursor = System.Cursors.HandClosed
Return True

The following MouseDown event handler for a Canvas changes the cursor to a Magnifying class if the user presses the mouse button while holding down the Alt key and the Magnify Smaller cursor if the user is holding down the Control key. Return True so that the MouseUp event is called.

If Keyboard.AsyncAltKey Then
Me.MouseCursor = System.Cursors.MagnifyLarger
ElseIf Keyboard.AsyncControlKey Then
Me.MouseCursor = System.Cursors.MagnifySmaller
End If

Return True

The following code in the MouseUp event restores the standard cursor.

Me.MouseCursor = System.Cursors.StandardPointer

The following code in the MouseEnter event hides the cursor.

System.Cursors.Hide

The following code in the MouseExit event shows the cursor.

System.Cursors.Show

See Also

Application, Control, MouseCursor, System, Window classes; System module