Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read terminates when mouse is used.

Status
Not open for further replies.

iyarosh

Programmer
Apr 14, 2003
49
US
Hello,

I'm having dificulties with my FoxProW 2.6 application. I have a screen with a number of fields. When I use tab to go from one field to another the application acts as normal; if I use mouse to jump from one field to another the read statement gets terminated and the screen closes. Thanks in advance for any help offered.
 
You might try running your app on a different computer and see if it acts the same way. Don't know if it will help, but it might.

Years ago using 2.5, I had a mouse problem. FoxPro would ignore all mouse clicks no matter where I clicked. After a lot of experimenting I was able to use READKEY() and LASTKEY() in tandem at the beginning of every program, procedure, & function to trap for mouse clicks. Later, I moved FP to another computer, and the problem totally disappeared without any changes in the app whatsoever. I have migrated several times since, and no more problems.

Have no idea why I had such a weird problem. Wish I had known about this board at that time (mid-1990s). Would have made solving the problem a lot easier.o
 
Dave,

No, I do not have any labels defined for mouse. I've tried to experiment with the labels when ran into this problem but it was no use.

Mmerlinn,

Unfortunately, the problem occurs on all the computers a ran it on. I have also tried using readkey and lastkey command with no success; I might have used them improperly thourgh.

Looks like this is something we'll have to live with. If you have any other thought or suggestions; I would highly appreciate them. Thank you.
 
If I remember correctly, neither READKEY() nor LASTKEY() can directly trap for a mouse click. At any rate, they wouldn't for me when I had my problems. I had to setup some special global variable set to an unused & non-typeable character (like CHR(1) or somesuch) and used that variable to check for mouse clicks. Complete royal pain to say the least.
 
By default, INKEY( ) doesn't detect a mouse click. To check for a mouse click, include M in <expC>. If M is included in <expC>, INKEY( ) returns the value 151 for a
single mouse click. Refer to the second example below to see how you can check for a double click.
INKEY( ) returns 0 if a key isn't pressed. If there are several keys in the typeahead buffer, the value of the first key entered in the buffer is returned.

Parameters

<expN>

<expN> specifies how many seconds INKEY( ) waits for a keystroke. If <expN> isn't included, INKEY( ) immediately returns a value for a keystroke. INKEY( ) waits
indefinitely for a keystroke if <expN> is 0.

<expC>

Include <expC> to show or hide the cursor or check for a mouse click. To show the cursor, include S in <expC>. To hide the cursor, include H in <expC>. If both S
and H are included in <expC>, the last character in <expC> takes precedence.

To check for a mouse click and show the cursor, include both M and S. To check for a mouse click and hide the cursor, include H and M.
When a keyboard macro is assigned to a key or key combination, you can include E in <expC> to expand the keyboard macro. When E is included, INKEY( )
returns a value corresponding to the first keystroke assigned to the keyboard macro. You can return successive values for each keystroke in a macro by
repeatedly executing INKEY( ) with E included. If E is not included, INKEY( ) returns the value for the key or key combination that triggers the keyboard macro.

Any characters besides H, M, S and E in <expC> are ignored.

Bob Palmer
The most common solution is H2O!
 
Bob Palmer:

That is the way it is supposed to work, but when I had my problems LASTKEY() would NOT trap mouse clicks no matter how I configured it, including using the M parameter. The mouse was totally invisible to LASTKEY(). Even including M, LASTKEY() would not return 151. In fact, it would not even fire, much less return a useable code.

mmerlinnf
 
hmm
The function MDOWN() will detect a mouse click but the original post intimated the the read statement terminating.
We used DO While <cond> loops to control forms with a READ CYCLE and tested user input/clicks or form nav in the control loop using a case statement. This way the read terminating was tested and the form would only close if a valid exit was selected.
I would guess the problem iyarosh is to do with control of the READ
Ensure you havn't got the NOMOUSE clause included and you are using a READ CYCLE

Bob Palmer
The most common solution is H2O!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top