Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » how to force ImageView snippet to update in RT
how to force ImageView snippet to update in RT [message #9386] Thu, 03 May 2007 17:47 Go to next message
ebojd is currently offline  ebojd
Messages: 225
Registered: January 2007
Location: USA
Experienced Member
I have some code that will eventually be a Real-Time graphics display. I am able to generate the proper images (via a libized version of Gnuplot)... I used a snippet of ImageView to load the image into a window:

void 
DCP::Load(const char *filename)
{
	img.SetImage(Null);
	FileIn in(filename);
	One<StreamRaster> r = StreamRaster::OpenAny(in);
	if(!r)
		return;
	Size rsz = img.GetSize();
	Size isz = r->GetSize();
	if(isz.cx >= rsz.cx || isz.cy >= rsz.cy) {
		if(isz.cx * rsz.cx < rsz.cy * isz.cy)
			rsz.cx = isz.cx * rsz.cy / isz.cy;
		else
			rsz.cy = isz.cy * rsz.cx / isz.cx;
		ImageEncoder m;
		Rescale(m, rsz, *r, isz);
		img.SetImage(m);
	}
	else
		img.SetImage(r->GetImage());
}


This works fine if I want to plot or display a single dataset, but my when my simulator loads up a dataset in a loop (which calls the processing routines and then loads the image):

void 
DCP::rt_sim()
{
	int i, ret;
	for(i=0;i<=320;i++)
	{
		char fname[256];
		
		sprintf (fname,"%s%02d.dat","./gauss_test",i%32);

		ret  = raw_range->read (fname, 0);
		ret |= raw_dat->read   (fname, 1);
		if (ret) {
        	PromptOK("[2R/ ERROR:]&parsing 2D input file in rt_sim");
        	return;
    	        }
    		
		raw_spectrum();
	}
}


nothing is displayed. I assume that the problem is that the load() method does not actually update the display and has to wait until control is given back to the main window.

My questions is: is there some trick to force an update the subwindow?

Thanks,

EBo --

[Updated on: Thu, 03 May 2007 18:09]

Report message to a moderator

Re: how to force ImageView snippet to update in RT [message #9393 is a reply to message #9386] Fri, 04 May 2007 15:35 Go to previous messageGo to next message
ebojd is currently offline  ebojd
Messages: 225
Registered: January 2007
Location: USA
Experienced Member
FYGI,

Well... I seem to have found a solution that works. I am not sure that it is the best, or for that matter safest, but it does work as expected. If anyone would care to comment...

In the code that processes the real-time data I simply added the following:

		bool b;
		Ctrl::ProcessEvents(&b);


It works on the Linux testbed -- soon to copy over to Win-XP and test again.

EBo --
Re: how to force ImageView snippet to update in RT [message #9395 is a reply to message #9386] Fri, 04 May 2007 20:02 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ebojd wrote on Thu, 03 May 2007 11:47


		sprintf (fname,"%s%02d.dat","./gauss_test",i%32);




String fname = Format("%s%02d.dat","./gauss_test",i%32);


(Could not resist).

As for updates: Yes, to get window repainted, it needs to recieve events. Call ProcessEvents() is exactly what you need here.... (no need to supply quit IMO).

Mirek
Previous Topic: Private members in Switch used in Paint
Next Topic: CursorImage in RectTracker
Goto Forum:
  


Current Time: Sat Apr 20 06:12:37 CEST 2024

Total time taken to generate the page: 0.04677 seconds