title: string/number from TextField to be used for calculation?
body: <p>sorry for my question and for the long explanation following here, probably there's a simple solution for someone who is experienced in Cocoa and Objective-C, but I'm just starting few weeks ago and I can't figure out how to get this thing working, Grrrrrrr!!</p>
  
  <p>OK, let's put it like this, in my window I have the following:</p>
  
  <p>2 TextField(NSTextField) called:</p>
  
  <ul>
  <li>blockOffText</li>
  <li>blockOnText</li>
  </ul>
  
  <p>1 Label(NSTextField) called:</p>
  
  <ul>
  <li>flightTimeText</li>
  </ul>
  
  <p>1 button(NSButton) called:</p>
  
  <ul>
  <li>updateButton</li>
  </ul>
  
  <p>What I want to do is all about time calculation I guess, get the "start-time" in one TextField and the "end-time" in the other.
  One is supposed to be the "takeoff-time" and the other the "landing-time" or for example the "duty-startTime" and "duty-endTime"...it's the same!
  Then I want to calculate the "flight-time" or "duty-time" and show it in the Label.</p>
  
  <p>At the end I will also need to store the value or the time in a database as an integer, the value should be represented by all minutes corresponding to each time, but the database part is not a problem at the moment.</p>
  
  <p>Maybe I can write the number in the TextField without the format but just the number and get the time show-up formatted in some way?
  I would like to write for example "1245" and "1525" without having the needs to put the ":" between the hours and minutes, then can I get the value formatted "12:45" "15:25" in the TextField in some way? Maybe after pressing the button?  </p>
  
  <p><strong>Ok, that is a second problem anyway, my real problem is I need to get the value I wrote in the TextField ("1245" and "1525") to be assigned to some variables in the program that I called "BlockOff" and "BlockOn".</strong>
  I need to transform them in an integer that represent the minutes corresponding to their value..example:</p>
  
  <p>The 1245 will become 765 minutes...(12 times 60 + 45)</p>
  
  <p>and 1525 will become 925 minutes...(15 times 60 + 25)</p>
  
  <p>HOW CAN I DO THIS?</p>
  
  <p>In this way I can use the minutes to calculate the difference to get the flight time or even add flight time to other flight time.</p>
  
  <p><strong>At the moment my program works a little bit differently</strong>... like this:
  If I directly assign the value to the two variables:</p>
  
  <p>int blockOff = 765;</p>
  
  <p>int blockOn = 925;</p>
  
  <p>then I can calculate and show in the two TextField the takeOff and landing time formatted like I want: "12:45" "15:25"...I use other 2 variables to do so:</p>
  
  <p>int oreBlkOff, minBlkOff = 0;</p>
  
  <p>minBlkOff = blockOff % 60;</p>
  
  <p>oreBlkOff = (blockOff - minBlkOff) / 60;</p>
  
  <p>Then I can show the value in the TextField:</p>
  
  <p>[blockOffText setStringValue:[NSString stringWithFormat: @"%d:%d", oreBlkOff, minBlkOff]];</p>
  
  <p>Same with blockOnText and flightTimeText, so there is no problem there, but this is not really what I need right?</p>
  
  <p>HOW CAN I GET THE VALUE OF THE TEXTFIELD AND STORE THE VALUE IN VARIABLES THAT CAN BE USED TO DO CALCULATION?</p>
  
  <p>HOW DO I GET THE FIRST TO DIGITS AND LAST TO DIGITS FROM THE VARIABLES SO I CAN USE THEM AS HOURS AND MINUTES FOR MY CALCULATION?</p>
  
  <p>I WOULD LIKE TO BE ABLE TO TYPE THE VALUE IN THE TEXTFIELD, PRESS "ENTER" OR "RETURN" AND GET THE VALUE ASSIGNED IN THE VARIABLE.</p>
  
  <p>IS THIS THE CORRECT WAY OR I'M JUST GOING THE WRONG WAY IN THIS.
  IN ANOTHER PROGRAM I DID IN VISUAL BASIC THAT WAS THE WAY I USED.</p>
  
  <p>THANK YOU VERY MUCH IN ADVANCE FOR YOU HELP!</p>
  
  <p>Gianluca</p>