Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   C extension with progress bar (http://www.velocityreviews.com/forums/t859717-c-extension-with-progress-bar.html)

Simi Lc 09-24-2009 10:30 AM

C extension with progress bar
 
Hi,

I have a ruby extension which shows a progress bar window.

The progress bar shows the progress of a loop in the ruby code.For each
iteration of the loop I call an extension method that sets the current
progress through the PBM_SETPOS message.

The progress bar is actually shown.The problem arises when I want to
implement a cancel button in the progress window.

While the progress is updating the window becomes unresponsive and
cancel button click does not work.

I tried to update the progress in C code through a separate thread using
CreateThread but it does not show the progress at all.

Kindly suggest solution to fix this problem

Thanks in advance and let me know any other details are required.

Simi
--
Posted via http://www.ruby-forum.com/.


Radosław Bułat 09-25-2009 12:20 PM

Re: C extension with progress bar
 
Calling function which is implemented purely in C will block it until
it returns. Maybe there is a way to call some rb_thread_shedule
(written from memory so it could be wrong) which will let other
threads to run.

--=20
Pozdrawiam

Rados=B3aw Bu=B3at
http://radarek.jogger.pl - m=F3j blog


Michal Suchanek 09-25-2009 01:52 PM

Re: C extension with progress bar
 
2009/9/24 Simi Lc <lalitha@angleritech.com>:
> Hi,
>
> I have a ruby extension which shows a progress bar window.
>
> The progress bar shows the progress of a loop in the ruby code.For each
> iteration of the loop I call an extension method that sets the current
> progress through the PBM_SETPOS message.
>
> The progress bar is actually shown.The problem arises when I want to
> implement a cancel button in the progress window.
>
> While the progress is updating the window becomes unresponsive and
> cancel button click does not work.
>
> I tried to update the progress in C code through a separate thread using
> CreateThread but it does not show the progress at all.
>
> Kindly suggest solution to fix this problem
>
> Thanks in advance and let me know any other details are required.
>


In general the UI library which you are using for drawing the progress
bar should provide means for doing this. However, the solution is
dependent on the library you use, unfortunately.

So the questions are

What you are using to display the progress bar?

Why did you choose this UI, can't a different library provide it? What
are the requirements?

Why did you choose to do that in C? Does the library lack ruby
bindings? Can't it be loaded through ffi?

Thanks

Michal


Axel Etzold 09-25-2009 09:00 PM

Re: C extension with progress bar
 
Dear Simi,

there is also a progress bar for Ruby here:

http://jordan.husney.com/archives/so...ressbar.tar.gz

It basically lets you print a png file, which you might then show somewhere.

Maybe this can be of use ...

Best regards,

AXel


--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



All times are GMT. The time now is 07:30 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.