0

This is what I wnat to do and I couldn't yet. Hope you can help me.

I have a button and a table. And I want to edit table content when I press this button. When I press my button in a mouseDown event I want to capture that event and, let's say, get the actual time. And when I release the button in a mouseUp event I want to get que actual time again and update a row in my table.

For example: 1- Press button (with out releasing it, capture mouseDown event): get actual time, let's say: 18:10:23. 2- Release button (capture mouseUp event): get actual time, let's say: 18:10:33. 3. Update my table:

-------------------------            -------------------------
|_#_|__start__|___end___|    ==>     |_#_|__start__|___end___|
| 1 |00:00:00 |00:00:00 |            | 1 |18:10:23 |18:10:33 |
-------------------------            -------------------------

How should I do this? My principal problem is that NSButton doesn't capture both mouseDown and mouseUp event.

Sebastian
  • 7,670
  • 5
  • 38
  • 50

2 Answers2

0

In the mouseDown: you fetch events until you see a corresponding mouseUp event.

Here’s a blog entry with examples.

Wil Shipley
  • 9,343
  • 35
  • 59
0

I could solve this

- (void)awakeFromNib
 {
       [_myButton sendActionOn:NSLeftMouseDownMask];
 }

and using what wil said

Sangram Shivankar
  • 3,535
  • 3
  • 26
  • 38