Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun Oct 22, 2017 9:43 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Timer animations stop during user input
PostPosted: Sat Mar 17, 2012 3:20 pm 
Offline

Joined: Sat Mar 17, 2012 1:35 pm
Posts: 2
Hello,

I hope this was the right board to post this question on; it seemed like the most likely group that would have dealt with this before!

I am new to RB but old to VB, so it mostly makes sense, but on a Mac running RS2011 r4.3, I just can't seem to make simple timer animations continue during any user input in any of my application windows such as resizing a window, moving a window, clicking on a button, etc...

All I was trying to do was move a canvas object back and forth on a window and eventually control some properties about it from another window while it continued to move (color, speed, etc...).

I have tried controlling the animation from a timer control and from a timer object created in code, and in both cases, the timer ceases to fire during these events (such as clicking on the title bar and leaving the mouse down). I have not tried anything with a thread because the documentation says you should still use a timer to get the results from the thread to control the UI, so it seems I would be right back where I started.

Is this even possible in RB on a Mac?

Thank you,

Rob


Top
 Profile  
Reply with quote  
 Post subject: Re: Timer animations stop during user input
PostPosted: Sat Mar 17, 2012 3:47 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
keyword here : THREADS

If you have the timer/animation and user input processing all in the main thread (which is where they all are by default).... The program can only do one thing at a time...... and User Keyboard input has a much higher priority that timer interrupts, so when there is keyboard/mouse activity, all timers in the main thread are suspended until free cycles become available again.

Multi-thread your application (read the manuals), and your keyboard input is on one thread, and timers on another.

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: Timer animations stop during user input
PostPosted: Sat Mar 17, 2012 3:59 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
I'm afraid threads won't help here. A timer is the correct choice, but there are certain actions like clicking a menu that stall/steal the event loop under Carbon. I believe Cocoa resolves this, but I'm not certain. You might try compiling for Cocoa.


Top
 Profile  
Reply with quote  
 Post subject: Re: Timer animations stop during user input
PostPosted: Sat Mar 17, 2012 4:23 pm 
Offline

Joined: Sat Mar 17, 2012 1:35 pm
Posts: 2
Thank you for the Cocoa tip! I had not thought to try anything like that.

It mostly works...if you resize the window with the actual animation in it and leave the mouse down without moving it, the timer will completely stop firing still. But if you keep moving the mouse it just interrupts the timer. You CAN resize another window in the application, though, as well as interact with controls, so this is a great start, thank you!

In reference to the threads is it really possible in RB to handle the mouse input for a window in a completely separate thread? I think I have a ways to go before I could try something like that...!

Thank you for the help,

Rob


Top
 Profile  
Reply with quote  
 Post subject: Re: Timer animations stop during user input
PostPosted: Sat Mar 17, 2012 4:31 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
rjriv wrote:
In reference to the threads is it really possible in RB to handle the mouse input for a window in a completely separate thread?

No. I think what Dave was alluding to was using the thread as a "timer". Otherwise, you cannot separate user interaction from a normal timer. Both are processed by the event loop, which is in the main thread.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group