[comp.sys.amiga.tech] ===> Need help with two problems <===

greenwoode@merrimack.edu (Ed Greenwood) (01/23/91)

Hi,

     I am writing a application program in C that uses the mouse,
gadgets, a printer, and the disk drive.  Most of the program 
consists of fixed screens such as graphs or menus.  I currently
have two unrelated problems.  First, if I insert or remove a disk 
while the program is running, it doesn't sound right.  Is there 
something that I must do in my program to use the disk drive?
My second question involves reading the mouse with IDCMP flags.
I am trying to read a users input from a menu that is on the full
screen.  Unless I press the mouse button very slowly, I seem to
get "ahead of it".  In other words, If I press the button fast 
on option number one six times, and then press it on option two, 
the program continues reading the mouse as if I were still 
selecting option number one for two to three more presses.  I 
would greatly appreciate any comments or suggestions.

                                                      Thanks, 
                
                                                      Ed Greenwood

  

lkoop@pnet01.cts.com (Lamonte Koop) (01/24/91)

greenwoode@merrimack.edu (Ed Greenwood) writes:
>
>Hi,
>
>     I am writing a application program in C that uses the mouse,
>gadgets, a printer, and the disk drive.  Most of the program 
>consists of fixed screens such as graphs or menus.  I currently
>have two unrelated problems.  First, if I insert or remove a disk 
>while the program is running, it doesn't sound right.  Is there 
>something that I must do in my program to use the disk drive?

Could you elaborate more?  What do you mean "it doesn't sound right".

>My second question involves reading the mouse with IDCMP flags.
>I am trying to read a users input from a menu that is on the full
>screen.  Unless I press the mouse button very slowly, I seem to
>get "ahead of it".  In other words, If I press the button fast 
>on option number one six times, and then press it on option two, 
>the program continues reading the mouse as if I were still 
>selecting option number one for two to three more presses.  I 
>would greatly appreciate any comments or suggestions.

That sounds normal.  You must remember that the messages you are processing in
a Window's UserPort [a message port] are queued.  They can "back up", in other
words.  When you are pressing the mouse button quickly on option 1, these
messages from Intuition are piling up at the UserPort, while your code is
attempting to get them, using GetMsg(), and then reply to them (ReplyMsg()),
and move on to the next message [and any intermediate processing].  GetMsg()
pulls the messages from the UserPort (or any port) on a First In First Out
basis, so you don't get to the last message in the list until the ones before
it are processed.

>
>                                                      Thanks, 
>                
>                                                      Ed Greenwood


                             LaMonte Koop
 Internet: lkoop@pnet01.cts.com         ARPA: crash!pnet01!lkoop@nosc.mil
           UUCP: {hplabs!hp-sdd ucsd nosc}!crash!pnet01!lkoop
  A scientist is one who finds interest in the kinetic energy of Jell-O
   moving at ridiculous velocities...an engineer is one who can find a
               real-life application for such silliness.