Checking functions help

This page of the help file documents the use of the check functions.
Checking functions enable you to check all kinds of window events using a very tiny number of functions.
You don't need to check all controls with separate functions thanks to the checking functions.

Checking functions work with slots, you first assign a window to a check function, then you check everything using a slot number.
A slot number can be any number between 1 and 100.

Function help:

Real API_Check_Set (Real Slot number, Real Window handle);

This function assigns a window to a check slot.

The previous window on this slot is automatically removed, if any.

Return value:
Returns true (1) when succeeded or false (0) otherwise.

Real API_Check_Remove (Real Slot number);

This function removes the window from the specified check slot, and restores the original window procedure to the window.

Return value:
Always returns true (1).
Real API_Check_Command (Real Slot number);

This function checks a specified slot and returns the command value.

When the returned value is greater than 0, the command value identifies a Control ID, an event from a control occurs.

Return value:
The command value.

Real API_Check_SecondaryCommand (Real Slot number);

This function checks the secondary command and returns the secondary command value.

The secondary command function enables you to get more specific command information.
For example, you use API_Check_Command, which tells you an event occurred to a button, but what kind of button event is it?
That's were API_Check_SecondaryCommand comes in, it can tell you wether it is clicked, double clicked, and go on.

You have to call this after API_Check_Command, because you first need to know if any event occurred.

Return value:
The secondary command value.
Real API_Check_TertiaryCommand(Real Slot number);

This function checks the tertiary command and returns the tertiary command value.

Return value:
The tertiary command value.
Real API_Check_SetDrag(Real Slot number, Real Dragging is enabled);

This function makes the window draggable by holding the left mouse button, if argument1 is set to 1.

Return value:
Always returns 1.
Real API_Check_GetDragFiles (Real Slot number);

This function returns the number of files dropped in the window.
The primary command is set to WM_DROPFILES when files are dropped in the window.

Return value:
Returns the number of dropped files.
String API_Check_GetDragFileName (Real Slot number, Real Zero Based File Number);

This function gets the file name of the dragged file number (0 = the first file, 1 = the second file, and go on ... ).

Return value:
Returns the number of dropped files.
Real API_Check_GetDragPointX (Real Slot number);

This function returns the mouse X position related to the window when the files were droppend in the window.

Return value:
Returns the X axis.
Real API_Check_GetDragPointY (Real Slot number);

This function returns the mouse Y position related to the window when the files were droppend in the window.

Return value:
Returns the Y axis.
Real API_Check_DragFinish (Real Slot number);

This function frees the memory that is used to store the drag information.

Return value:
Always returns 1.

Example code:

// In the create event

API_Check_Set (1,Win) // Assign a window to slot 1

// In the step event

Command = API_Check_Command (1); // Check commands for check handle 1

if ( Command == Button1 ) // Button1 sends a command
{
Second = API_Check_SecondaryCommand (1); // Check the command type

if ( Second == BN_DBLCLK) // The button is double-clicked
{
show_message ("You double-clicked Button1.");
}

}

if
( Command == WM_DROPFILES ) // Files were dropped in the window
{
NumFiles = API_Check_GetDragFiles (1); // Get the number of files
X = API_Check_GetDragPointX (1); // Get drag x
Y = API_Check_GetDragPointY (1); // Get drag y

show_message ("You dragged "+string (NumFiles)+" file(s) into the window at "+string (X)+","+string (Y)+".");

Current = 0;

while (Current < NumFiles) // Loop through all files
{
show_message (API_Check_GetDragFileName (1,Current)); // Show the file name
Current += 1;
}

API_Check_DragFinish (1); // Free the memory
}

Return to help index