TGMsgBox

Hi,

Seems a naive question, but can’t figure it out.

I am creating a TGMsgBox, and want it to be always the active window, and be on top of all windows
unless it is dismissed/closed.

This is my code

void Fitter::popupMSG(std::string a){
  msg_box = new TGMsgBox(gClient->GetRoot(), p_wind,  "Message", a.c_str(), kMBIconStop);
}

Googleing I found an old post, in which the situation is opposite,
In his case, by default the new window was always on top of the parent.
root.cern.ch/root/roottalk/roottalk02/2323.html

Thanks,
Rafo

Hi Rafo,

[quote=“rafopar”]I am creating a TGMsgBox, and want it to be always the active window, and be on top of all windows
unless it is dismissed/closed.[/quote]
Well, this is supposed to be the default behavior, isn’t it the case for you?
Which OS, ROOT version, compiler?

Cheers, Bertrand

Thank you Bertrand,

These are, os, root and gcc versions
-OS: Red Hat Enterprise Linux Workstation release 7.3 (Maipo)
-Root Version: Version 5.34/21 9 September 2014

  • Compiler gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

Yes, it is not the case for me, For example in this screnshoot you can see
the message box is behind the main window

As an additional information, on the same computer I run guitest.C as well, but in
guitest it behaves opposite, i.e. message box are above the main window.

Thank you,
Rafo

Hi Rafo,

Then this is probably something related to you main window. How do you create it?
Could you post a minimal running script showing this issue?

Cheers, Bertrand.

Thanks Bertrand,

I tried to keep minimum things,
attached are files, and the code below is a mekefile code (didn’t allow me to attach a makefile)

If it compiles,
you can run as “/dbg_harp_fitter any_argument”

all: clean dict exe

clean:
        rm -f dbg_harp_fitter dbg_FitterDict.cxx dbg_FitterDict.h 

exe:    dbg_FitterDict.cxx  dbg_Fitter.cxx
        g++ `root-config --cflags --glibs` -lSpectrum -o dbg_harp_fitter dbg_Fitter.cxx dbg_FitterDict.cxx

dict:   dbg_Fitter.h FitterLinkDef.h
        rootcint -f dbg_FitterDict.cxx -c dbg_Fitter.h FitterLinkDef.h

Thanks,
Rafo
dbg_Fitter.cxx (3.41 KB)
FitterLinkDef.h (31 Bytes)
dbg_Fitter.h (900 Bytes)

Try:

void Fitter::popupMSG(std::string a){ msg_box = new TGMsgBox(gClient->GetRoot(), fMain, "Message", a.c_str(), kMBIconStop); }
Cheers, Bertrand.

Ok thanks, it works now!!

My mistake,
Thanks for catching it so soon

Rafo