Mouse Event Help

Discussion in 'Mac Programming' started by Fearless Leader, Nov 2, 2008.

  1. Fearless Leader macrumors 68020

    Joined:
    Mar 21, 2006
    Location:
    Hoosiertown
    #1
    I'm new to working with the gui, usually only terminal, so If I'm hard to follow I'm sorry.

    I'm trying to store the points from a click into a MutableArray, each time I click I add a point to it. When I click down The log message i placed within my

    Code:
    -(void)mouseDown:(NSEvent*)theEvent
    {
    }
    
    it correctly displays the point within the window, however when I go to add the point to the array it doesn't look like its accessing the one the was initialized at startup, and nothing gets added. No instance variables can be accessed with code inside mouseDown.

    However If i make the code respond to a button click or something along those lines it can access the instance variables and thus the array. I cant seem to figure out what is going on here. If someone knows where to look in the documentation to help me that would be great because I've looked allover. Or if someone knew of a simple example of how cocoa and mouse events work together correctly that would also be great.

    Thank you,
    -FL-
     
  2. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    You will need to post more code (and errors, if any). Hard to tell what's going on. Also make sure you don't have a 2nd copy of the view being initialized unnecessarily.
     

Share This Page