[comp.sys.mac] A plea for help

marty@june.cs.washington.edu (Marty Sirkin) (01/19/89)

I am a brand new Mac programmer with a very strange problem.  I wrote a
simple program shell (in Think Pascal) to do basic menu/window/mouse/keyboard
interface.  Some of the code was taken from the Chernicoff (sp?) book, and
some is my own.

I wrote the program shell on a Mac 2, and it worked just fine.  I have 
discovered, though, that it does have a problem running on other machines
(I've tried it on two Mac Se, and two other Mac 2's).  The program itself
(run either as an application, or in the compiler's integrated environment)
runs just great.  When I leave it, however, double cliking for ALL other
programs is disabled.  Single clicking and menu clicks (also single) work
just great.

I don't know enough about the machine architecture to even have a guess where
to start.  It seems to me that there must be something that I am doing in
the program, yet the shell is very simple.  Also, I thought it might have
something to do with a special resource which only likes the machine on which
it is compiled, but I compiled a new copy on a different machine - same 
problem.  

Any help would be greatly appreciated, either by posting, or by E-mail.

						Thanks,
						Marty Sirkin
						marty@june.cs.washington.edu

bob@accuvax.nwu.edu (Bob Hablutzel) (01/19/89)

Marty Sirkin writes:

> I am a brand new Mac programmer with a very strange problem.  I wrote a
> simple program shell (in Think Pascal) to do basic menu/window/mouse/keyboard
> interface.  Some of the code was taken from the Chernicoff (sp?) book, and
> some is my own.

> I wrote the program shell on a Mac 2, and it worked just fine.  I have 
> discovered, though, that it does have a problem running on other machines
> (I've tried it on two Mac Se, and two other Mac 2's).  The program itself
> (run either as an application, or in the compiler's integrated environment)
> runs just great.  When I leave it, however, double cliking for ALL other
> programs is disabled.  Single clicking and menu clicks (also single) work
> just great.

  Is it possible you are changing the event mask? In particular, if you are
disabling the mouse-up events, later programs will not be able to get the last
time the mouse button comes up, which is a common means of getting the start
time for timing double clicks. If you disable events in the event mask, you
should make sure to restore them before you exit.


Bob Hablutzel	Wildwood Software	BOB@NUACC.ACNS.NWU.EDU

dan@lclark.UUCP (Dan Revel) (01/20/89)

In article <6977@june.cs.washington.edu> marty@june.cs.washington.edu (Marty Sirkin) writes:
>I wrote [a] program ... on a Mac [II], and it worked ... fine.  [But] it [has]
>a problem running on other machines [SEs, +s].  The program runs ... great.
>When I leave it, however, double cliking for ALL other programs is disabled.
>Single clicking and menu clicks (also single) work just great.
>						Thanks,
>						Marty Sirkin

I've experienced what I think is the same problem.  I developed a program
on the Mac II which works just fine there but which disables double clicking
in the Finder after it is used on other Macs.

Sorry Marty, I don't know why this happens either, but I sure would like to
find out!

As in Marty's case I used Chernicoff's 'Macintosh Revealed' as a starting
point, perhaps there's something there since things which I have written
using MacApp don't have this difficulty.  (By the way I'm using MPW Pascal)

Inquiring minds want to know!
-- 
dan@lclark
tektronix!reed!lclark!dan			Dylsexics untie! (-|

jackiw@cs.swarthmore.edu (Nick Jackiw) (01/20/89)

In article <6977@june.cs.washington.edu> marty@june.cs.washington.edu (Marty Sirkin) writes:
> I am a brand new Mac programmer with a very strange problem. 
> The program itself
> (run either as an application, or in the compiler's integrated environment)
> runs just great.  When I leave it, however, double cliking for ALL other
> programs is disabled.  Single clicking and menu clicks (also single) work
> just great.
> 
> Any help would be greatly appreciated, either by posting, or by E-mail.
> 
> 						Thanks,
> 						Marty Sirkin
> 						marty@june.cs.washington.edu

From tech note #202, revised December 1988:

"..._Finder Anomaly_...

When MultiFinder is disabled, users will notice a strange behaviour in the
Finder (versions 6.0 and later) after quitting applications which fail to
restore the event mask. If an application failed to restore the event mask
when quitting and had set the event mask to mask out mouse-up events, all
mouse-up events would continue to be masked out, and the user would notice
that the Finder no longer recognizes double clicks.

..."

Could this be your problem?  If you fool with the event mask, be sure to
set it back to its default. E-Mail me for more details if this sounds
promising but isn't detailed enough to solve your problem.

-Nick



-- 
+-------------------+-jackiw@cs.swarthmore.edu / !rutgers!bpa!swatsun!jackiw-+
|  nicholas jackiw  | jackiw%campus.swarthmore.edu@swarthmr.bitnet           |
+-------------------+-VGP/MathDept/Swarthmore College, Swarthmore, PA 19081--+
                          PER ASPERA AD ASTRA

billkatt@sol.engin.umich.edu (Steve Bollinger) (01/20/89)

In article <379@lclark.UUCP> dan@lclark.UUCP (Dan Revel) writes:
>In article <6977@june.cs.washington.edu> marty@june.cs.washington.edu (Marty Sirkin) writes:
>>I wrote [a] program ... on a Mac [II], and it worked ... fine.  [But] it [has]
>>a problem running on other machines [SEs, +s].  The program runs ... great.
>>When I leave it, however, double cliking for ALL other programs is disabled.
>>Single clicking and menu clicks (also single) work just great.
>>						Thanks,
>>						Marty Sirkin
>
You are setting the event mask to mask mouse-up events.  The reason that "it
works on a Mac II" is probably because you ran it under Multifinder on the II,
and Multifinder resets the event mask when your program ends.
Put this at the end of your program to fix the problem:
SetEventMask(everyEvent-MouseUpMask)
or better yet, don't set the mask on entry.

+----------------------+----------------------------------------------------+
| Steve Bollinger      | Internet: billkatt@caen.engin.umich.edu            |
| 4297 Sulgrave Dr.    +------+---------------------------------------------+
| Swartz Creek, Mi. 48473     | "My employer doesn't take my opinion any    |
+-----------------------------+  more seriously than you do."               |
| "You remember the IIe, it   +---------------------------------------------+
| was the machine Apple made before they decided people didn't need         |
| machines with big screens, color, or slots."                              |
|                                 - Harry Anderson (from NBC's Night Court) |
+---------------------------------------------------------------------------+

marty@june.cs.washington.edu (Marty Sirkin) (01/21/89)

In article <10330115@accuvax.nwu.edu>, bob@accuvax.nwu.edu (Bob Hablutzel) writes:
>> [about double click problems...]

>   Is it possible you are changing the event mask? In particular, if you are
> disabling the mouse-up events, later programs will not be able to get the 
> last time the mouse button comes up, which is a common means of getting the
> start time for timing double clicks. If you disable events in the event 
> mask, you should make sure to restore them before you exit.

Yes I was, and thanks to all the (almost 50!) people who responded with help!

					Marty Sirkin

ra_robert@gsbacd.uchicago.edu (01/21/89)

In article <379@lclark.UUCP>, dan@lclark.UUCP (Dan Revel) writes...
 
>In article <6977@june.cs.washington.edu> marty@june.cs.washington.edu (Marty Sirkin) writes:
>>I wrote [a] program ... on a Mac [II], and it worked ... fine.  [But] it [has]
>>a problem running on other machines [SEs, +s].  The program runs ... great.
>>When I leave it, however, double cliking for ALL other programs is disabled.
>>Single clicking and menu clicks (also single) work just great.
>>						Thanks,
>>						Marty Sirkin
> 
>I've experienced what I think is the same problem.  I developed a program
>on the Mac II which works just fine there but which disables double clicking
>in the Finder after it is used on other Macs.

Chernicoff's program has several bugs in it, and this is a manifestation
of one of them.  I think he sets the event mask (filtering out mouseUp ?)
and it never gets reset.  Something like that.  Anyway, the behavior is
traceable to Chernicoff's program (sorry, but I saw this on the net a while
ago and don't remember exactly what the problem with the event mask was).


Robert
------
ra_robert@gsbacd.uchicago.edu
------
generic disclaimer: all my opinions are mine