Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title Turning the cursor on or off
Ref. No. QNX.000009533
Category(ies) Development
Issue We have an application where we need to turn the Photon cursor on or off.  Is this possible?  How?

Solution There are no 'built-in' options or functions to do this, but it is very easy to turn the mouse cursor on or off from code.  Here is an example:

#define        ON    1
#define        OFF    0

int CursorOnOff( int state )
{
FILE *fp;
char buffer[20];
PhRegion_t region;
int rid;

PhAttach( NULL, NULL );  //find pointer region
fp = popen( "phin -h -PInput -f r", "r" );
if( fgets( buffer, 20, fp ) )
{
  rid = atoi( buffer );
  PhRegionQuery( rid, ®ion, NULL, NULL, 0);
  if (state==ON)
    region.flags |= Ph_PTR_REGION;         
    // -- cursor on

  if (state==OFF)
    region.flags &= ~Ph_PTR_REGION;
    // -- cursor off

  PhRegionChange(Ph_REGION_FLAGS, 0, &ion, NULL, NULL );
  return(1);
}
else
return(0);
} // End function CursorOnOff