Sign in Join
Wiki copytemporary

Cursor: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11Cursor - [[Property|property]] of the TCursor Object.
22
33## List of cursor constants
44
5-<table>
6-<thead>
7-<tr>
8-<th><p>Constant</p></th>
9-<th><p>Integer value</p></th>
10-<th><p>Shape</p></th>
11-</tr>
12-</thead>
13-<tbody>
14-<tr>
15-<td><p>crDefault</p></td>
16-<td><p>0</p></td>
17-<td><figure>
18-<img src="crArrow.png" title="crArrow.png" />
19-<figcaption>crArrow.png</figcaption>
20-</figure></td>
21-</tr>
22-<tr>
23-<td><p>crNone</p></td>
24-<td><p>-1</p></td>
25-<td><p>Invisible mouse pointer</p></td>
26-</tr>
27-<tr>
28-<td><p>crArrow</p></td>
29-<td><p>-2</p></td>
30-<td><figure>
31-<img src="crArrow.png" title="crArrow.png" />
32-<figcaption>crArrow.png</figcaption>
33-</figure></td>
34-</tr>
35-<tr>
36-<td><p>crCross</p></td>
37-<td><p>-3</p></td>
38-<td><figure>
39-<img src="crCross.png" title="crCross.png" />
40-<figcaption>crCross.png</figcaption>
41-</figure></td>
42-</tr>
43-<tr>
44-<td><p>crIBeam</p></td>
45-<td><p>-4</p></td>
46-<td><figure>
47-<img src="crIBeam.png" title="crIBeam.png" />
48-<figcaption>crIBeam.png</figcaption>
49-</figure></td>
50-</tr>
51-<tr>
52-<td><p>crSize</p></td>
53-<td><p>-22</p></td>
54-<td><figure>
55-<img src="crSize.png" title="crSize.png" />
56-<figcaption>crSize.png</figcaption>
57-</figure></td>
58-</tr>
59-<tr>
60-<td><p>crSizeNESW</p></td>
61-<td><p>-6</p></td>
62-<td><figure>
63-<img src="crSizeNESW.png" title="crSizeNESW.png" />
64-<figcaption>crSizeNESW.png</figcaption>
65-</figure></td>
66-</tr>
67-<tr>
68-<td><p>crSizeNS</p></td>
69-<td><p>-7</p></td>
70-<td><figure>
71-<img src="crSizeNS.png" title="crSizeNS.png" />
72-<figcaption>crSizeNS.png</figcaption>
73-</figure></td>
74-</tr>
75-<tr>
76-<td><p>crSizeNWSE</p></td>
77-<td><p>-8</p></td>
78-<td><figure>
79-<img src="crSizeNWSE.png" title="crSizeNWSE.png" />
80-<figcaption>crSizeNWSE.png</figcaption>
81-</figure></td>
82-</tr>
83-<tr>
84-<td><p>crSizeWE</p></td>
85-<td><p>-9</p></td>
86-<td><figure>
87-<img src="crSizeWE.png" title="crSizeWE.png" />
88-<figcaption>crSizeWE.png</figcaption>
89-</figure></td>
90-</tr>
91-<tr>
92-<td><p>crUpArrow</p></td>
93-<td><p>-10</p></td>
94-<td><p>|<img src="crUpArrow.png" title="crUpArrow.png" alt="crUpArrow.png" /></p></td>
95-</tr>
96-<tr>
97-<td><p>crHourGlass</p></td>
98-<td><p>-11</p></td>
99-<td><figure>
100-<img src="crHourGlass.png" title="crHourGlass.png" />
101-<figcaption>crHourGlass.png</figcaption>
102-</figure></td>
103-</tr>
104-<tr>
105-<td><p>crDrag</p></td>
106-<td><p>-12</p></td>
107-<td><figure>
108-<img src="crDrag.png" title="crDrag.png" />
109-<figcaption>crDrag.png</figcaption>
110-</figure></td>
111-</tr>
112-<tr>
113-<td><p>crNoDrop</p></td>
114-<td><p>-13</p></td>
115-<td><p>|<img src="crNoDrop.png" title="crNoDrop.png" alt="crNoDrop.png" /></p></td>
116-</tr>
117-<tr>
118-<td><p>crHSplit</p></td>
119-<td><p>-14</p></td>
120-<td><figure>
121-<img src="crHSplit.png" title="crHSplit.png" />
122-<figcaption>crHSplit.png</figcaption>
123-</figure></td>
124-</tr>
125-<tr>
126-<td><p>crVSplit</p></td>
127-<td><p>-15</p></td>
128-<td><p>|<img src="crVSplit.png" title="crVSplit.png" alt="crVSplit.png" /></p></td>
129-</tr>
130-<tr>
131-<td><p>crMultiDrag</p></td>
132-<td><p>-16</p></td>
133-<td><figure>
134-<img src="crMultiDrag.png" title="crMultiDrag.png" />
135-<figcaption>crMultiDrag.png</figcaption>
136-</figure></td>
137-</tr>
138-<tr>
139-<td><p>crSQLWait</p></td>
140-<td><p>-17</p></td>
141-<td><figure>
142-<img src="crSQLWait.png" title="crSQLWait.png" />
143-<figcaption>crSQLWait.png</figcaption>
144-</figure></td>
145-</tr>
146-<tr>
147-<td><p>crNo</p></td>
148-<td><p>-18</p></td>
149-<td><figure>
150-<img src="CrNo.png" title="CrNo.png" />
151-<figcaption>CrNo.png</figcaption>
152-</figure></td>
153-</tr>
154-<tr>
155-<td><p>crAppStart</p></td>
156-<td><p>-19</p></td>
157-<td><figure>
158-<img src="crAppStart.png" title="crAppStart.png" />
159-<figcaption>crAppStart.png</figcaption>
160-</figure></td>
161-</tr>
162-<tr>
163-<td><p>crHelp</p></td>
164-<td><p>-20</p></td>
165-<td><figure>
166-<img src="crHelp.png" title="crHelp.png" />
167-<figcaption>crHelp.png</figcaption>
168-</figure></td>
169-</tr>
170-<tr>
171-<td><p>crHandPoint</p></td>
172-<td><p>-21</p></td>
173-<td><figure>
174-<img src="crHandPoint.png" title="crHandPoint.png" />
175-<figcaption>crHandPoint.png</figcaption>
176-</figure></td>
177-</tr>
178-</tbody>
179-</table>
5+| Constant | Integer value | Shape |
6+|-------------|---------------|----------------------------------------|
7+| crDefault | 0 | ![](/wiki-images/b/b8/CrArrow.png) |
8+| crNone | -1 | Invisible mouse pointer |
9+| crArrow | -2 | ![](/wiki-images/b/b8/CrArrow.png) |
10+| crCross | -3 | ![](/wiki-images/4/4f/CrCross.png) |
11+| crIBeam | -4 | ![](/wiki-images/3/32/CrIBeam.png) |
12+| crSize | -22 | ![](/wiki-images/1/16/CrSize.png) |
13+| crSizeNESW | -6 | ![](/wiki-images/b/ba/CrSizeNESW.png) |
14+| crSizeNS | -7 | ![](/wiki-images/2/2e/CrSizeNS.png) |
15+| crSizeNWSE | -8 | ![](/wiki-images/3/34/CrSizeNWSE.png) |
16+| crSizeWE | -9 | ![](/wiki-images/8/8c/CrSizeWE.png) |
17+| crUpArrow | -10 | \|![](/wiki-images/2/24/CrUpArrow.png) |
18+| crHourGlass | -11 | ![](/wiki-images/2/2f/CrHourGlass.png) |
19+| crDrag | -12 | ![](/wiki-images/b/b7/CrDrag.png) |
20+| crNoDrop | -13 | \|![](/wiki-images/5/5c/CrNoDrop.png) |
21+| crHSplit | -14 | ![](/wiki-images/0/09/CrHSplit.png) |
22+| crVSplit | -15 | \|![](/wiki-images/9/99/CrVSplit.png) |
23+| crMultiDrag | -16 | ![](/wiki-images/1/1e/CrMultiDrag.png) |
24+| crSQLWait | -17 | ![](/wiki-images/8/82/CrSQLWait.png) |
25+| crNo | -18 | ![](/wiki-images/3/32/CrNo.png) |
26+| crAppStart | -19 | ![](/wiki-images/e/e8/CrAppStart.png) |
27+| crHelp | -20 | ![](/wiki-images/4/44/CrHelp.png) |
28+| crHandPoint | -21 | ![](/wiki-images/e/eb/CrHandPoint.png) |
18029
18130## Examples
18231
18332### Example 1: To View All The Cursor Types
18433
18534\(1\) On [[TForm|Form1]], drag a [[TComboBox|ComboBox]] control onto the Form.
18635
18736\(2\) Set the ComboBox1, Items (TStrings) to the following:
18837
18938``` pascal
19039crAppStart
19140crArrow
19241crCross
19342crDefault
19443crDrag
19544crHandPoint
19645crHelp
19746crHourGlass
19847crHSplit
19948crIBeam
20049crMultiDrag
20150crNo
20251crNoDrop
20352crNone
20453crSizeAll
20554crSizeNESW
20655crSizeNS
20756crSizeNWSE
20857crSizeWE
20958crSQLWait
21059crUpArrow
21160crVSplit
21261```
21362
21463\(3\) On the ComboBox1Change procedure add this code:
21564
21665``` pascal
21766procedure TForm1.ComboBox1Change(Sender: TObject);
21867begin
21968 Cursor := StringToCursor(ComboBox1.Text);
22069end;
22170```
22271
22372This will allow you to select the cursor type from the ComboBox and see it when you move the mouse over the Form. Only when you hover over the ComboBox will the cursor return to the default (crDefault).
22473
22574### Example 2: Change An Objects Cursor
22675
22776``` pascal
22877procedure TForm1.FormCreate(Sender: TObject);
22978begin
23079 Cursor := crHourGlass;
23180 // Changes the Form1 cursor to an hour glass.
23281
23382 Button1.Cursor := crHourGlass;
23483 // Changes the Button1 cursor to an hour glass.
23584
23685 Memo1.Cursor := crHourGlass;
23786 // Changes the Memo1 cursor to an hour glass.
23887end;
23988```
24089
24190### Example 3: Change All Controls To An Hour Glass, Except TBitBtn Controls
24291
24392``` pascal
24493procedure TForm1.FormCreate(Sender: TObject);
24594var
24695 I: Integer;
24796begin
24897 Cursor := crHourGlass;
24998 for I := 0 to ControlCount - 1 do
25099 begin
251100 if (Controls[I].ClassType <> TBitBtn) then
252101 Controls[I].Cursor := crHourGlass;
253102 end;
254103end;
255104```
256105
257106However, if you had a GroupBox, you would have to address the controls within it separately.
258107
259108``` pascal
260109procedure TForm1.FormCreate(Sender: TObject);
261110var
262111 I: Integer;
263112begin
264113 Cursor := crHourGlass;
265114 for I := 0 to ControlCount - 1 do
266115 begin
267116 if (Controls[I].ClassType <> TBitBtn) then
268117 Controls[I].Cursor := crHourGlass;
269118 end;
270119 for I := 0 to GroupBox1.ControlCount - 1 do
271120 begin
272121 if (GroupBox1.Controls[I].ClassType <> TBitBtn) then
273122 GroupBox1.Controls[I].Cursor := crHourGlass;
274123 end;
275124end;
276125```
277126
278127With the above example, in which you had Form1, as well as other controls on the form such as [[TMemo|Memo]], [[TEdit|Edit]], [[TImage|Image]], [[TBitBtn|BitBtn]], etc., this would change all but the BitBtn controls to the Hour Glass. There are controls such as the [[TGroupBox]], [[TPanel]], that act as individual containers for controls, and these items must be addresses separately from the main Form in order to change their internal control set to a different cursor at [[runtime]].
279128
280129---
281130*From the Free Pascal wiki, page "Cursor", as it stood on 2020-11-12 after a change by Arent, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history