
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - Norton Guide
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
FUNCky provides many different methods for deciding where the
mouse cursor is located on the screen. If you are using the
m_inbutton() or m_release() functions you can use the
corresponding m_inrow() and m_incol() functions to find out where
the mouse cursor was located at the time the user clicked. Two
companion functions are m_row() and m_col(). These 2 functions
differ from their 2 counterparts m_inrow() and m_incol() in one
simple respect. The m_in* functions always return the mouse
cursor position at the time the user clicked while the m_row()
and m_col() functions return the current mouse cursor location.
The slight difference is useful because the user might have moved
the mouse cursor to another location by the time you get to check
where the mouse cursor is located. If for example you display 3
items, and then wait for mouse input, you might want to open a
database before you check the location of the mouse cursor. The
delay you incur to open the database is enough time for the user
to relocate the mouse cursor before you get to check which item
the cursor was on at the time they clicked.
Other extremely useful mouse cursor functions are m_region() and
m_aregion(). Most of time you will want to verify that the mouse
cursor is within a certain region of the screen, and not just a
single row/col coordinate. An example would be an option to
'Quit' that is enclosed inside a box at coordinates 10,40,13,50.
You will need to check if the mouse cursor is within the 4
coordinates, not just a particular row/col location. The function
m_region() will return .T. or .F. depending if the mouse cursor
is contained within the region defined by the 4 parameters. Your
mouse location check would then be:
if ( m_region(10,40,13,50) )
close databases
quit
endif
Another situation arises where you have multiple displayed
options on the screen and you need to check to see if the mouse
cursor is within any one of those regions. The m_aregion()
function can help you decide which region out of several regions
the mouse cursor is located within. The m_aregion() takes 4
parameters just like m_region(), but the four parameters are
arrays of regions. Where parameter #1 is the array of top rows,
parameter #2 is the array of left columns, parameter #3 is the
array of bottom rows and parameter #4 is an array of right
columns. A call to m_aregion() will return the element # that
corresponds to the region that the mouse cursor is located
within. If you had 3 items displayed on the screen and you need
to check which one the user selected, you would load the 4 arrays
with 3 elements each. The three elements correspond to the three
items being displayed. Your three items might be:
'ADD'
'EDIT'
'QUIT'
You would need to load the four arrays with the row/column
coordinates of all the displayed items. An example would be:
declare rows[3], cols[3], rows2[3], cols2[3]
* 'ADD' option coordinates
rows[1] = 10
cols[1] = 10
rows2[1]= 10
cols2[1]= 12
* 'EDIT'' option coordinates
rows[2] = 11
cols[2] = 10
rows2[2]= 11
cols2[2]= 13
* 'QUIT' option coordinates
rows[3] = 12
cols[3] = 10
rows2[3]= 12
cols2[3]= 13
Then a call to m_aregion() would be as follows:
choice = m_aregion( rows, cols, rows2, cols2 )
If the mouse cursor was over the word 'EDIT', then m_aregion()
would return the number 2 since the second element of the 4
arrays define the exact coordinates of the word 'EDIT'. Likewise,
if the mouse cursor is over the word 'ADD', then the return value
would be 1. If the mouse cursor is not inside any of the
coordinates defined by the four arrays, then a 0 value is
returned.
See Also: m_row() m_col() m_region() m_aregion()
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson