UI doesn't redraw until mouse moves

33 views
Skip to first unread message

Michael Terry

unread,
Dec 19, 2009, 8:28:17 PM12/19/09
to objec...@googlegroups.com
As with the poster in this thread:


...I remove a view, but the screen doesn't change until I move the mouse. Here's where it happens:

- (void)uploadButton:(UploadButton)aButton didFinishUploadWithData:(CPString)aString
{
    [progress removeFromSuperview];
    [_sidebarView setNeedsDisplayInRect: progressRect];
    console.log("Screen updated");
}

I've tried with setNeedsDisplay:YES and without any setNeedsDisplay, also. In each case, the progess gif only goes away when I move the mouse.

Michael

Alexander Ljungberg

unread,
Dec 20, 2009, 10:19:53 AM12/20/09
to Cappuccino & Objective-J
You can try pumping the run loop:

[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];

On Dec 20, 2:28 am, Michael Terry <mich...@michaelterry.org> wrote:
> As with the poster in this thread:
>

> http://groups.google.com/group/objectivej/browse_thread/thread/2004b6...

Michael Terry

unread,
Dec 20, 2009, 11:54:50 AM12/20/09
to objec...@googlegroups.com
It worked! And now I see I should be investigating CPRunLoop. Thanks very much.

--

You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
To post to this group, send email to objec...@googlegroups.com.
To unsubscribe from this group, send email to objectivej+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/objectivej?hl=en.



Ross Boucher

unread,
Dec 20, 2009, 12:32:17 PM12/20/09
to objec...@googlegroups.com
Code which runs asynchronously has to either be part of a run loop, or fire the run loops events, using the line in that last email.

Most of the cases are handled automatically by Cappuccino. All timeouts, mouse/key events, notifications, observers, etc. all are part of the existing run loop. But it is possible in certain cases for external components to cause new asynchronous events, like your file upload widget is doing.

Michael Terry

unread,
Dec 22, 2009, 2:19:58 AM12/22/09
to objec...@googlegroups.com
So what's a good file to look at to learn how make my async events part of the run loop? Firing the run loop fixed the immediate problem, but the next mouse click after doing so is lost. I assume there's an event counter or something that's gotten out of sync by my firing the run loop manually?
Reply all
Reply to author
Forward
0 new messages