GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Sep 19, 2014 9:49 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Cancel Button Available During Heavy Processing ?
PostPosted: Sun Oct 14, 2007 11:58 pm 
Offline

Joined: Sun Oct 14, 2007 11:27 pm
Posts: 3
Hi,

In my application I have a processing which produce a "freeze" feeling.
I can avoid this with a progressbar updated like this (freepascal code) :

Code:
    while (g_main_context_iteration (NULL, FALSE)) do
    begin
      Fraction := I / Number_of_Channels;
      gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pProgressBarScan), Fraction);
      scan_label := PChar(' Capturing Channel #'+inttostr(I)+' ['+C_A[I]+']...');
      gtk_statusbar_push (GTK_STATUSBAR (pStatusBar), 0, scan_label);
      gtk_main_iteration;
    end;

This works fine but now I'd like to add a CANCEL button to stop the processing if needed.
However I'm unable to keep any button reachable during the operation.
Does anyone know how to proceed please ?

Thx.
T6


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 15, 2007 3:01 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
In C, we often use:
Code:
while( gtk_events_pending() ) { gtk_main_iteration(); }

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 15, 2007 5:45 pm 
Offline

Joined: Sun Oct 14, 2007 11:27 pm
Posts: 3
Thanks for your reply.
I've actually seen such syntax several times. However after implementing it into my code the application still behaves on the same way and I'm unable to click anything :(
Is there something else to add with this ?
Thx.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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
You cannot post attachments in this forum

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