Gdk-Error while running a Gui class using script in winxp

Hi,

I am running a script which sets up a gui using Root’s gui classes and it run fine so far but no it fails to run. It pops up the main window but at the same time this error message also appears in a pop-up window (in winxp):

“Gdk-Error **: file gdkgc0win32.c: line 967: assertion failed:
(data->xgc == NULL)
aborting…”

I think I made something wrong since it worked before but I just can’t find the problem.

I am sure there are other problems too which I can’t figure out.
I wan’t to generate ascii output files and I use the TGFileDialolg and
TGFileinfo to set up a path for the output files. But for some reason I cannot use it for output pathes/files but only for input files.

I attached the script. The first half of the script is a class that I use for my analysis, the Gui starts at the second part. The Gui class is called: MyMainFrame. If it works the user first needs to set the parameters on the right side (by clicking on the “set” button). Then from the file menu he has to set the “table path” first (by going to a give folder and giving an arbitrary name for the ascii ouput - like output.txt), then choose the “calib file” and by choosing it the code reads the data file in (I attached a sample data file). After this, by clicking on the draw button, the code should draw two - 1d and 2d - histograms.

Thanx,

Balint
calib2_2005_4_26_16_28_13_1.tim.txt (292 KB)
DataReducs.C (25.8 KB)

for the FileDialog try to set some space for the m_sUserPath let say 100 or use TString

The problem is with the char * m_sTablePath variable. But thanx!

Balint

Hi balint,

In your code, replace :

by :

fLabel[i] = new TGLabel(fF1, numlabel[i]); fLabel[i]->SetTextFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1", kTRUE);
Cheers,
Bertrand.

Hi Bertrand,

Thanx!It works! Would you be so kind as to help me with the other problem.
That is that I cannot open an ofstream by giving him a path to file with the TGFileDialofg and TGFileInfo classes?

Thanx again,

(As you see, I switched from VC++ to ROOT Gui - It is really much easier!:))

Balint

Hi Balint,

Sorry, I didn’t read carefully your post :blush:

Replace this kind of code :m_sTablePath = fj.fFilename; by:m_sTablePath = strdup(fj.fFilename); So the string pointer will be still valid when going out of scope. :wink:

Cheers,
Bertrand.

Hi,

I put strdup() functions and but I gor this error message:

Error: Function strdup(fj.fFilename) is not defined in current scope FILE:C:\DOCUME~1\Balint\DESKTOP\DataReducs.C LINE:712

I include string.h though.

Balint

Hi Balint,

Sorry, I meant StrDup(), as defined in TString.h…

Cheers,
Bertrand.

Hi Bertrand,

Great! It works fine! :smiley:

I am wondering why I couldn’t fine the same function that I had used three lines above … :-s

Balint