cocoa - string/number from TextField to be used for calculation? -


Sorry for my question and for a long explanation given here, possibly a simple solution for that person I have been experienced in the purpose and, but I am starting just a few weeks ago and I can not understand how it is working, Grrrrrrr !!

OK, keep it like this, in my window, I have the following text: 2 TextField (NSTextField):

  • BlockOffest
  • BlockOntest

1 label (NSTextField)):

  • flightTimeText

1 button (NSButton):

  • updateButton

What do I want to do, I think about the timetable, "start-time" in one textfield and the second "end-time" "Receive one is considered" takeoff-time "and the second" landing-time " Or for example "Duty-Start Time" and "Duty-Endime" ... this is the same! Then I want to calculate "flight-time" or "duty time" and show it in the label.

In the end I have to store the value or time in the database, the integer must be presented by all the minutes in relation to each time, but the database part is not a problem at this time.

Maybe I can write numbers in TextField without the format, but only numbers and formatting time of the show in some time? I would like to write "1245" and "1525" for example: ":" Without the need to write between hours and minutes, I can get the value "12:45" "15:25" in the textfield Kind? Maybe after pressing the button?

Okay, this is another problem, however, my actual problem is that I need to get the value written in the text field ("1245" and "1525"), in which some variables The program will be assigned which I have called "Blockoff" and "BlockOn". I have to convert them to an integer, which represent the minutes according to their values. Example:

1245 will become 765 minutes ... (12 times 60 + 45)

and 1525 925 minutes will be made ... (15x60 + 25)

How can I do this?

In this way, I can use minutes to calculate the difference to get flight time or can add flight flight time to other flight times also.

My program works slightly differently at the moment ... like this: If I specify the value of two variables directly:

int BlockOff = 765;

int blockOn = 925;

Then I can count in two TextField and show the Leftoff and Landing Time formatted as I want: "12:45" "15:25" ... I have to do another 2 variables to do this I use:

Intelabeloff, Minbilloff = 0;

Minbilloff = Blockoff% 60;

OrableOff = (Block Off - Minbilloff) / 60;

Then I can show the value in TextField: P> With blockOn text and flightTimeText, then there is no problem, but does it really do not need me right?

How can I get the value of textfile and prices can be bought in those values ​​which can be evaluated?

How do I get the digits first and eventually separate them from the data, can I use them in homes and minutes for my calcration?

I should be able to like the value in the text field, press "Enter" or "Back" and get the value included in the value.

Is this the right way or I am sitting in it wrongly? In another program, I used to work in Visual Basic as I used to.

Thanks a lot for you!

Gianluca

To get the int value from the text field, you IntegerValue or floatValue will be used for float. But you should definitely see the date / time control in Coca-Cola.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -