NSView and NSTextField

Discussion in 'Mac Programming' started by gomezman78, Dec 24, 2010.

  1. gomezman78 macrumors newbie

    Dec 24, 2010
    I'm sorry if this is a simple question but I cannot find an answer anywhere and I've been working on this problem for a couple of days now.

    Basically, what I am trying to do is create a program where the user will input a value into a NSTextField, click a button, and that value will become a coordinate value for a point in a NSView.

    Everything I have tried automatically draws the point before the user even inputs any information. Is there a good tutorial out there for this problem that I'm not finding? It seems like it would be a pretty simple solution and maybe I've just been staring at the screen too long.

  2. BadWolf13 macrumors 6502

    Dec 17, 2009
    Without seeing any code, I can't be certain of a solution, but I can offer some ideas.

    First, you say it draws the point before the user enters any information. Well, the big question is, where is your view getting the coordinate values that it's using to draw the point?

    Further to this one, where are you initializing this NSPoint(which I'm assuming is where you're holding the coordinate values) Are you initializing it when the program starts, or when the user clicks the aforementioned button? Given that you don't even have a point until the user clicks the button, I don't see any reason for the NSPoint to be initialized during the startup sequence.

    I may not be a guru, given that I still ask more questions than I answer, but hopefully that helps.

Share This Page