RE: [ROOT] Window refresh using Win2K and GDK

From: ANCIANT E. (eric_anciant@sodern.fr)
Date: Thu Jan 08 2004 - 17:36:24 MET


I am using ( latest ) version : root_v3.10.02.win32gdk_Debug

In order to clarify my point, look the slightly modified example below,
with the app.Run() call at the end of the program, 
if I try to resize the window DURING the loop the canvas/pad doesn't get
resized,
it will be only once the execution reaches app.Run()

This behaviour is new to me, since resizing the canvas DURING execution (and
without instanciating 
TApplication or running it) was possible with the old root 3.02 I had been
using (for a while.. )

I was just wondering if this is a desired ( recommanded ? ) behaviour ..
seems that before the Update() method could detect that the OS-window size
changed, and not anymore

In fact, with the old 3.02 version I could pause execution from within my
program, save canvas under poscript files for example
(the canvas menus were there) and then restart the execution by hitting a
keyboard key (all this with no TApplication instance)
I am not sure of how I should do such a thing now, calling
TApplication::Run() "freeze" the execution of my application;
or is there a way to return from that call into the main execution program ?
In my test-example below for example how can I continue the execution of the
rest of the program if I uncomment the first
app.Run() ? 

Thanks for your patience ...

eric


 -- QUOTE -- 

#include "TApplication.h"
#include "TSystem.h"
#include "TEnv.h"
#include "TH1.h"
#include "TCanvas.h"

#include <iostream>
using namespace std;

//#include <iostream.h>

int main(int argc, char* argv[])
{
	cout << " Using ROOTSYS " << gSystem->Getenv("ROOTSYS") << endl;
	cout << " Using DYNAMIC PATH " 
		<< gEnv->GetValue("WinNT.*.Root.DynamicPath","NOT DEFINED")
<< endl;
	cout << " Using MACRO PATH " 
		<< gEnv->GetValue("WinNT.*.Root.MacroPath","NOT DEFINED") <<
endl;

    TApplication app("app",0,0);
	TCanvas can("toto","titi",300,300);

	TH1F histo("histo","histo",10,-3,3);
	int i;
//	app.Run();
	for (i=0;i<1000;i++ ) {
		histo.FillRandom("gaus",10);
		histo.Draw();
		gPad->Update();
	}
	app.Run();

	cin >> i;

	return 0;
}

-------------------------- QUOTE COMPILATION :

--------------------Configuration: TestConsole - Win32
Debug--------------------
Compiling...
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
cl /G5 /MD /GR /I "p:\root_v3.10.02.win32gdk_Debug/include" /D "WIN32" /D
"_DEBUG" /D "_WIN32" /D "_MT" /D "VISUAL_CPLUSPLUS" /D "_WINDOWS"
/Fo"Debug/" /Fd"Debug/" /FD /EHsc /c 
   "P:\APS_LOCAL\TESTROOT\TestConsole\TestConsole.cpp"
TestConsole.cpp
Linking...
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib 
uuid.lib odbc32.lib odbccp32.lib gdk-1.3.lib glib-1.3.lib libCint.lib
libCore.lib libEG.lib libEGPythia6.lib libfreetype.lib libFumili.lib
libGeom.lib libGeomPainter.lib libGpad.lib libGraf.lib libGraf3d.lib
libGui.lib libHbook.lib libHist.lib libHi
stPainter.lib libHtml.lib libMatrix.lib libMinuit.lib libMLP.lib
libPhysics.lib libPostscript.lib libProof.lib libProofGui.lib libRFIO.lib
libRGL.lib libRint.lib libTable.lib libTree.lib libTreePlayer.lib
libTreeViewer.lib libVMC.lib libWin32gdk.lib
 /pdb:none /debug /machine:IX86 "/out:Debug/TestConsole.exe"
"/libpath:p:/root_v3.10.02.win32gdk_Debug/lib" -opt:ref
/subsystem:console,4.0 
.\Debug\TestConsole.obj 

TestConsole.exe - 0 error(s), 0 warning(s)

------------------- QUOTE : Console ouput

Using ROOTSYS p:\root_v3.10.02.win32gdk_Debug
Using DYNAMIC PATH
.;p:\root_v3.10.02.win32gdk_Debug/bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\Sy
stem32\Wbem;C:\DLL-PWB-OLD;C:\DLL-PWB-NEW;w:\oracle\ora81\bin;w:\oracle\jre\
1.1.7\bin;W:\ORAWIN\BIN;p:\root_v3.10.02.win32gdk_Debug\bin;p:\vni\cnl50\bin
;p:\rcs;p:\AnciantLocal\FTCCDSensor;p:\anciantlocal\simualgo\main\bin;p:\bin
;p:\VS\VC98\bin;p:\Visual Studio\MSDev98\bin
Using MACRO PATH .;p:\root_v3.10.02.win32gdk_Debug/macros
Error in <TWinNTSystem::BaseName>: name = 0

> -----Message d'origine-----
> De:	Brandon Kohn [SMTP:blk@maia-institute.org]
> Date:	jeudi 8 janvier 2004 12:15
> À:	ANCIANT E.; 'Valeri Fine'; 'Rene Brun'; 'roottalk@root.cern.ch'
> Objet:	Re: [ROOT] 
> 
> Assuming that you are using the latest version of ROOT, the problem with
> resizing (really refreshing the canvas) is due to the fact that you must
> have the instance of the application running it's event loop. This is done
> using TApplication::Run(); Try placing this at the end of your test
> program,
> and see if you get resizing behavior then.
> 
> Regards
> Brandon
> ----- Original Message ----- 
> From: "ANCIANT E." <eric_anciant@sodern.fr>
> To: "'Valeri Fine'" <fine@bnl.gov>; "'Brandon Kohn'"
> <blk@maia-institute.org>; "'Rene Brun'" <Rene.Brun@cern.ch>;
> "'roottalk@root.cern.ch'" <roottalk@pcroot.cern.ch>
> Sent: Thursday, January 08, 2004 11:11 AM
> Subject: RE: [ROOT]
> 
> 
> > Thanks a lot for the quick help,
> >
> > indeed, instanciating one TApplication solve my "pop-up" problem
> > no need to have it run ( which is not what I was looking for since I use
> > Root
> > rather as a display facility .. )
> >
> > however now I got an Error message :
> >
> > Error in <TWinNTSystem::BaseName>: name = 0
> >
> > Besides, when I try to resize the window of my canvas (without the
> > TApplication instance running),
> > the content of the window (Canvas?, pads, histograms ..) don't get
> resized.
> >
> > I don't know if it is linked to the error message.
> >
> > Or I guess I could wrap everything within the App and launch my
> application
> > through a button ?
> >
> > regards,
> >
> > eric
> >
> >
> >
> >
> > > -----Message d'origine-----
> > > De: Valeri Fine [SMTP:fine@bnl.gov]
> > > Date: mercredi 7 janvier 2004 18:23
> > > À: 'Brandon Kohn'; 'ANCIANT E.'; 'roottalk@root.cern.ch'
> > > Objet: RE: [ROOT]
> > >
> > > I think the reason for your troubles is the "gdk" version.
> > > Did you say you did use very "gdk" in past?
> > >
> > No, it is the first time I try GDK ( before I was using root 3.02
> > with win32 )
> > >
> >



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET