How to Improve FoxPro for Windows Insertion Point Visibility

Last reviewed: July 11, 1995
Article ID: Q132415
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.6a

SUMMARY

Not to be confused with the mouse pointer, the vertical bar that indicates where the next character typed will appear is called the insertion point in Windows-based applications.

There may be times when the insertion point is difficult to locate visually. For example, the user may have trouble locating the insertion point at higher resolutions, on screens with poor color contrasting, or in a display of crowded objects.

The program in this article uses two techniques to provide visual clues as to which field is active and where the insertion point is.

MORE INFORMATION

The current field can be differentiated from the others by setting the color of the GET. To do this, add a COLOR clause to the READ statement to change the second color pair, as in this example:

   READ COLOR ,N/GR*    && produces black on bright yellow; note comma

Within Screen Builder, the #READCLAUSE generator directive followed by the appropriate COLOR statement is placed in the Setup code section:

   #READCLAUSE COLOR ,GR+/N  && note first color pair defaulted by comma

To enhance the visibility of the insertion point, increase the blink rate. While it is possible to set the blink rate for the entire system through the Desktop icon under Control Panel in the Windows Program Manager, the following code demonstrates how to set and reset it from within FoxPro.

Code Sample

** S E T C A R E T . P R G ** ** Program to change the blink rate of the insertion point (caret) ** This program assumes FOXTOOLS.FLL is in the same directory ** >> NOTE: Press ESC to exit, or remove CYCLE from READ and TAB through.

ON KEY LABEL F12 DO blinkit WITH '+' && to increment blink rate ON KEY LABEL F11 DO blinkit WITH '-' && to decrement blink rate

wink = 4   && exponent for incremental blink rate controls

*--- the following are the functions needed to change the blink rate SET LIBRARY TO foxtools set_blink = REGFN("SetCaretBlinkTIme","I","I") get_blink = REGFN("GetCaretBlinkTIme","","I") && note NULL value
blinc = CALLFN(get_blink)   && store system blink rate
sbnul = CALLFN(set_blink, INT( ( blinc / 32 ) * wink ) ) && fast rate *--- blinc is in milliseconds; algorithm provides 32 settings

DEFINE WINDOW test AT 10,10 SIZE 20,45 ACTIVATE WINDOW test

@12,2 SAY 'Rate [ 1 - fastest / 32 - slowest ]: '+ TRANSFORM(wink, '99') @13,2 SAY ' <F11> decrease | <F12> increase '

@2,2 GET this DEFAULT '          ' FONT 'Arial',10
@4,2 GET real DEFAULT 123 FONT 'Arial',10

READ CYCLE COLOR ,GR+/N && example of READ COLOR clause

sbnul = CALLFN(set_blink, blinc) && resets back to system blink rate RELEASE LIBRARY foxtools DEACTIVATE WINDOW test RELEASE WINDOW test ON KEY

PROCEDURE blinkit PARAMETER incr IF incr = '+'

    wink = IIF( wink = 1, 1, wink - 1 )
ELSE
    wink = IIF( wink = 32, 32, wink + 1 )
ENDIF sbnul = CALLFN(set_blink, INT( ( blinc / 32 ) * wink ) ) && new rate @12,2 SAY 'Rate [ 1 - fastest / 32 - slowest ]: '+ TRANSFORM(wink, '99')

When run, the current field will have a black background with bright yellow letters. By pressing the F11 or F12 function key when the pointer is in a field, you can change the blink rate of the insertion point. Once you are satisfied with the visibility, press the ESC key to exit the program and return the blink rate to normal.


Additional reference words: FoxWin 2.60a
KBCategory: kbenv kbprg kbcode
KBSubcategory: FxenvOs


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 11, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.