home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!goanna!sheoak!redgum.ucnv.edu.au!i925936
- From: i925936@redgum.bcae.oz.au (-The Shadow-)
- Newsgroups: comp.sys.mac.programmer
- Subject: Simple Problem
- Message-ID: <1897@sheoak.bcae.oz.au>
- Date: 31 Jul 92 01:55:11 GMT
- Sender: news@sheoak.bcae.oz.au
- Organization: UCNV, Bendigo, Victoria, Australia
- Lines: 79
- Originator: i925936@redgum.ucnv.edu.au
-
- Here is a simple problem which I can't find the solution to. I have only
- just started with programming the mac toolbox so I don't know *too* much
- yet. The problem is that the program I am writing will not detect a
- mousedown event. Below is a listing of the program condensed to
- determine a mousedown event.
- In the form below, it will not quit until
- doquit is true. I know that I have not set doquit to true anywhere but
- as I said, the program is condensed.
-
- Program whatever;
-
- type eventrecord = record
- what : integer;
- message : longint;
- when : longint;
- where : point;
- modifiers : integer;
- end;
-
-
- const nullevent = 0;
- mousedown = 1;
- mouseup = 2;
- mdownmask = $0002;
- mupmask = $0004;
- everyevent = $FFFF;
-
- var theevent : eventrecord;
-
- procedure initialise;
- var themask : integer;
-
- begin
- doquit := false;
- themask := everyevent - keyupmask - mupmask;
- seteventmask(themask);
- flushevents(everyevent, 0);
- setcursor(arrow);
- end;
-
- function getnextevent(mask : integer; var theevent : eventrecord):
- boolean;
- begin
- end;
-
- procedure doevent;
- begin
- if getnextevent(everyevent, theevent then
- case theevent.what of
- mousedown : domousedown;
- end;
- end;
-
- procedure mainloop;
- begin
- systemtask;
- doevent;
- end;
-
- begin
- initialise;
- repeat
- mainloop;
- until doquit;
- end.
-
-
- There are probably a heap of problems in this program but I can't work
- out what they are. The mask of the event keeps returning a value of -1
- too and getnextevent returns a true value.
- Is there a better way to set up the function getnextevent as well?
-
- Anyway, somebody out there should know the answer to this. Please reply
- by either email at i925936@redgum.ucnv.edu.au or by this newsgroup
- because it took *ages* to write this out!
- BTW, the program is written in THINK Pascal version 4.0
-
- Thanx,
- Richard.
-