Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mouse Cursor
Message
De
29/08/1997 08:46:16
 
 
À
28/08/1997 18:24:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
00047287
Message ID:
00047535
Vues:
26
Hi Vlad,
As I suspected the MouseIcon and MousePointer properties only work when the cursor is over the active cell of the grid. I wan the pointer changed for the whole column.

Here is my scenario. My test grid has 10 columns. Column4 contains a text box and a combo box. I want the pointer to be an arrow over this column at all times ( other columns too but I am just testing for usage right now :-) ). when the cursor moves over column4 I want the I-beam changed to an arrow. When the cursor then moves over Coulmn3, Column5 or some part of the grid I want it changed back to the default I-beam. Following are the methods and the code I have been testing to accomplish this:

Grid Init code:

DECLARE INTEGER LoadCursorFromFile in Win32API string
DECLARE INTEGER SetSystemCursor in Win32API integer, integer
DECLARE INTEGER CopyIcon in Win32API integer
PUBLIC ARRAY MouseCursors[2,2]

MouseCursors[1,1] = 32512 && Normal Arrow
lnCursorHandle = LoadCursor( 0, 32512 )
MouseCursors[1,2] = CopyIcon( lnCursorHandle )
MouseCursors[2,1] = 32513 && I-beam
lnCursorHandle = LoadCursor( 0, 32513 )
wait window ( "IBeam cursor handle " + str( lnCursorHandle ) )
MouseCursors[2,2] = CopyIcon( lnCursorHandle )
wait window ( "CopyIcon return " + str( MouseCursors[2,2] ) )

The above wait windows indicate valid return values


Grid Column3 MouseMove, Column5 MouseMove, Grid MouseMove, Form Destroy code to restore I-beam cursor:

lnOk = SetSystemCursor( MouseCursors[2,2], 32513 )
wait window ( "Reset Cursor " + str( lnOk ) )
RELEASE MouseCursors && In Form Destroy only


Grid Column4 MouseMove code to change I-beam to arrow:

lnHandle = LoadCursorFromFile( "Normal01.cur" )
lnOk = SetSystemCursor( lnHandle, 32513 )


With the above scenario, when I start up the form and grid, if I move the cursor over Column3 first ( restore I-beam ), I get a WAIT WINDOW indicating success from SetSystemCursor() ( return value 1 ). If I then move the cursor to Column4, the I-beam is successfully changed to an arrow. If I then move the cursor to Column3 or Column5 to reset it to an I-beam, I get a WAIT WINDOW indicating failure from SetSystemCursor() ( return value 0 ). From that point on the cursor is stuck as an arrow and cannot be changed back to an I-beam. The grid MouseMove and Form Destroy code also fail to restore the I-beam. Either I am missing something ( that is probably obvious ) or else there is a system bug or it is not possible to do what I am trying to do. i would appreciate any thoughts you have on this. OS is WinNT 4.0 SP3, VFP 5.0a.

Thanks,
Bill



>Anyway, please let me know what you found out. Thanks.
>
>Vlad
>
>>Thanks Vlad. I will look at the MouseIcon property and see if I can get it to work. However I have a feeling it will only change the cursor when the pointer is over the active cell in a grid and I want it to change for the whloe column. If I can't get it to work, I'll get the code together and send it to you.
>>
>>Thanks again,
>>Bill
>>
>>
>>>Can you send me the code you have in those methods? Ie: all the code that involves the cursor changing mechanism. I can try to guess what the problem might be, but I prefer to go directly to the source.
>>>
>>>Beside that: If you change the IBeam system cursor, it will be changed in all applications. Since you do it in MouseMove, you can't know for sure when to restore it (there's no event to know that the mouse left the object in VFP). Usually, you can't do something in MouseMove if you need a restore action when the mouse leaves the object (unless you build all your framework on this concept: all objects know that there might be something to restore).
>>>
>>>That means the IBeam cursor might never be restored.
>>>
>>>It looks to me that the use of the MouseIcon property here would be more apropriate.
>>>
>>>Vlad
>>>
>>>>Hi Vlad,
>>>> I have been experimenting with the mouse cursor set and reset code in the FAQ and am having a problem with it. I still must be missing something. I have been experimenting with changing just one mouse cursor ( the I-beam, 32513 ) in a grid to the normal arrow using LoadCursorFromFile() and SetSystemCursor() then changing it back to the I-Beam using CopyIcon() and SetSystemCursor() using the algorithm in the FAQ. I set the new cursor in the MouseMove() of one of the columns of the grid and reset it in the MouseMove() of a different column ( and also the Destroy of the form ). If I first move over the column that restores the I-Beam before moving over the column that changes it to an arrow, SetSystemCursor() reports it successfully changed it back to the I-beam. But if I then change the cursor to an arrow by moving over the appropriate column, the cursor changes to an arrow successfully, but then moving over the column to reset it, SetSystemCursor() reports it failed and the
>>cursor
>>>>remains an arrow. The code in the Destroy also fails. I tried storing the original I-beam cursor using CopyIcon() in both a form property array and a Public array with the same results. Copyicon() returned a valid value indicating success. OS is WinNT 4.0, SP3. Can you shed any light on where I am missing it?
>>>>
>>>>Thanks,
>>>>Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform