Cursor – Giavapps Windows API

api_cursor_add(FileName) Adds a .CUR file. The function returns the CursorHandle or false if fails.

FileName: string that indicates a path to a specified file.

 

api_cursor_delete(CursorHandle) Deletes a cursor and frees any memory the cursor occupied. If the function succeeds, the return value is true, or false otherwise.

CursorHandle: it must be a CursorHandle.

 

api_cursor_set(ControlHandle, CursorHandle) Sets the cursor shape to the class of the specified ControlHandle.

ControlHandle: it can be any control handle (WindowHandle, ButtonHandle, ComboBoxHandle, etc.).
CursorHandle: it must be a CursorHandle.

 

api_cursor_set_default(ControlHandle, DefaultCursor) Sets a default system cursor to the class of the specified ControlHandle. This function is compatible with GameMaker: Studio cursor constants.

ControlHandle: it can be any control handle (WindowHandle, ButtonHandle, ComboBoxHandle, etc.).
DefaultCursor: default cr_* cursor constant.

 

api_cursor_get(ControlHandle) Retrieves a handle to the cursor shape assigned to the class of the specified ControlHandle.

ControlHandle: it can be any control handle (WindowHandle, ButtonHandle, ComboBoxHandle, etc.).

 

api_cursor_set_current(CursorHandle) Sets the current cursor shape. If your application must set the cursor while it is in a window, make sure the class cursor for the specified control’s class is set to cr_none (see api_cursor_set_default() ). If the class cursor is not cr_none, the system restores the class cursor each time the mouse is moved.

CursorHandle: it must be a CursorHandle.

 

api_cursor_get_current() Retrieves a handle to the current cursor.

 

api_cursor_set_position(X, Y) Moves the cursor to the specified screen coordinates. If the new coordinates are not within the screen rectangle set by the most recent api_cursor_set_clip() function call, the system automatically adjusts the coordinates so that the cursor stays within the rectangle.

 

api_cursor_get_x() Returns the X position of the cursor.

 

api_cursor_get_y() Returns the Y position of the cursor.

 

api_cursor_set_clip(X, Y, W, H, Enabled) Confines the cursor to a rectangular area on the screen. If a subsequent cursor position (set by the api_cursor_set_position() function or the mouse) lies outside the rectangle, the system automatically adjusts the position to keep the cursor inside the rectangular area.

X: x position.
Y: y position.
W: width.
H: height.
Enabled: enables (true) or disables (false) the clip feature.

 

api_cursor_get_clip_x() Returns the x position of the rectangular area set with api_cursor_set_clip() function.

 

api_cursor_get_clip_y() Returns the y position of the rectangular area set with api_cursor_set_clip() function.

 

api_cursor_get_clip_width() Returns the width of the rectangular area set with api_cursor_set_clip() function.

 

api_cursor_get_clip_height() Returns the height of the rectangular area set with api_cursor_set_clip() function.

 

api_cursor_set_show(ShowState) Displays or hides the cursor.

ShowState: displays (true) or hides (false) the cursor.

 

api_cursor_get_show() Returns the cursor state.

The cursor state can be one of the following values:

CURSOR_HIDDEN The cursor is hidden.

CURSOR_SHOWING The cursor is showing.

CURSOR_SUPPRESSED Windows 8: The cursor is suppressed. This flag indicates that the system is not drawing the cursor because the user is providing input through touch or pen instead of the mouse.

 

Code Examples

 

Adding and Setting a Custom Cursor

 

cursor = api_cursor_add("mycursor.cur");
api_cursor_set(window,cursor);

 

Setting a Default Cursor

 

api_cursor_set_default(button,cr_handpoint);

 

Freeing Memory Occupied by Resources

 

api_cursor_delete(cursor);

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*