GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Sep-2004, 11:00
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light

[FLTK] Howto refresh a widget immediately


I have a small program, where the I do a somewhat lengthy process from FLTK. I wanted to be able to track the status of this process in my dialog, so I added an Fl_Output widget where I can drop the status at certain points, such as:

CPP / C++ / C Code:
d->ot_info->value("WAIT --- Computing weekly scores");

This works fine, except that it does not "refresh" the screen until my entire process is completed. Is there a way that I can make FLTK refresh the widget immediately when I change it?
  #2  
Old 18-Sep-2004, 07:47
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
I got two equally good answers to this problem. The first is to set the widget damage to 1, like:

CPP / C++ / C Code:
d->ot_info->value("WAIT --- Computing weekly scores");
d->ot_info->damage(1);

This immediately redraws the widget.

The second is to call Fl::check(), which checks everything to make sure that a redraw is not needed everywhere.
CPP / C++ / C Code:
d->ot_info->value("WAIT --- Computing weekly scores");
Fl::check();

Both worked equally well as far as I could tell. I choose to use the first, because it seems to be more efficient, as it only checks the applicable widget. However, I could not perceive a performance difference in either of these methods.
  #3  
Old 18-Sep-2004, 08:52
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Okay, I jumped the gun a bit. Setting damage to 1 does not seem to work. So the only valid answer I have is:

CPP / C++ / C Code:
d->ot_info->value("WAIT --- Computing weekly scores");
Fl::check();

Sorry... But this does seem to work
  #4  
Old 09-Nov-2004, 03:08
podarok's Avatar
podarok podarok is offline
New Member
 
Join Date: Nov 2004
Location: Ukraine, Київ
Posts: 23
podarok is on a distinguished road
Question

and Yet One Question - how to refresh it in fltk2.0?
  #5  
Old 09-Nov-2004, 03:42
Ponder_Stibbons Ponder_Stibbons is offline
New Member
 
Join Date: Nov 2004
Posts: 7
Ponder_Stibbons is on a distinguished road
Quote:
Originally Posted by podarok
and Yet One Question - how to refresh it in fltk2.0?
Whats about redraw()?
I can not try but it sounds like it should do it.
Regards Mark
  #6  
Old 09-Nov-2004, 04:01
podarok's Avatar
podarok podarok is offline
New Member
 
Join Date: Nov 2004
Location: Ukraine, Київ
Posts: 23
podarok is on a distinguished road
Quote:
Originally Posted by Ponder_Stibbons
Whats about redraw()?
I can not try but it sounds like it should do it.
Regards Mark
not work 8(....
fltk::check(); //too
log_b->damage();//too
log_b->redraw();//too
in any combination...
  #7  
Old 09-Nov-2004, 07:23
dsmith's Avatar
dsmith dsmith is offline
Senior Member
 
Join Date: Jan 2004
Location: Utah, USA
Posts: 1,351
dsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of lightdsmith is a glorious beacon of light
Oh you are kidding! This doesn't work under 2.0? I am going to have to download the cvs to play with, but it amazes me that this is not carried through...
  #8  
Old 09-Nov-2004, 08:23
podarok's Avatar
podarok podarok is offline
New Member
 
Join Date: Nov 2004
Location: Ukraine, Київ
Posts: 23
podarok is on a distinguished road
Unhappy

Quote:
Originally Posted by dsmith
Oh you are kidding! This doesn't work under 2.0? I am going to have to download the cvs to play with, but it amazes me that this is not carried through...
my code is:
CPP / C++ / C Code:
for (i=0;i<100;i++){
log_b->add("hm...");
log_b->bottomline(i);
//here I want to refresh
log_w->damage();//the same with redraw()
fltk::check();//nothing ... even after end of this block log_b(Browser) stay in freeze on 1st line(topline)
}
log_b->bottomline(100);//this work!
//my sources are from http://www.fltk.net (a few week before (298 arc number))
Attached Files
File Type: zip fltest.zip (490 Bytes, 21 views)
  #9  
Old 11-Dec-2004, 01:54
fltk2user fltk2user is offline
New Member
 
Join Date: Dec 2004
Posts: 5
fltk2user is on a distinguished road
Quote:
Originally Posted by podarok
my code is:
for (i=0;i<100;i++){
log_b->add("hm...");
log_b->bottomline(i);
//here I want to refresh
log_w->damage();//the same with redraw()
fltk::check();//nothing ... even after end of this block log_b(Browser) stay in freeze on 1st line(topline)
}
log_b->bottomline(100);//this work!
//my sources are from http://www.fltk.net (a few week before (298 arc number))

You propably want to do:
CPP / C++ / C Code:
 for(int i=0;i<100;i++)
 {
   log_b->add("hm...");
   log_b->bottomline(log_b->children()-1);
   log_b->set_focus();
   // fltk::check(); // Call this if you need to update in each iteration of loop
 }
This will select always select last line in fltk::Browser
 
 

Recent GIDBlogUS Elections and the ?Voter?s Responsibility? by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:55.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.