Hi Suvayu,
OK, I will try to play a bit with that...
But note to vertically add frame (one below each other), you should use
a TGVerticalFrame (m_EB_frame)
And as a general comment, when you add/remove frames, you should call
something like:
MapSubwindows()
Resize(GetDefaultSize())
Layout()
Cheers, Bertrand.
On 5/15/2012 4:54 PM, suvayu ali wrote:
> Hi Bertrand,
>
> On Tue, May 15, 2012 at 4:47 PM, Bertrand Bellenot
> <bertrand.bellenot_at_cern.ch> wrote:
>> Hi,
>>
>> And which layout hints do you use when adding the frames?
>> What is the layout hint of the tab?
>> Could you copy and paste the relevant code?
>>
> I have put bits of the relevant code below.
> + m_EB_frame is a TGCompositeFrame
> + m_eCanvasErrorBanks is a TRootEmbeddedCanvas
>
>
> m_EB_frame->RemoveFrame(m_eCanvasErrorBanks);
>
> // make button frames
> if (m_EB_btnframes.empty()) {
> m_EB_btnframes.push_back
> (new TGHorizontalFrame(m_EB_frame, m_w, 33, kFixedWidth));
> m_EB_btnframes.push_back
> (new TGHorizontalFrame(m_EB_frame, m_w, 33, kFixedWidth));
> m_EB_btnframes.push_back
> (new TGHorizontalFrame(m_EB_frame, m_w, 33, kFixedWidth));
> m_EB_btnframes.push_back
> (new TGHorizontalFrame(m_EB_frame, m_w, 33, kFixedWidth));
> }
>
> // I add TGTextButtons to the TGHorizontalFrames here
>
> // add button frames and canvas to EB frame
> m_EB_frame->AddFrame(m_EB_btnframes[0],
> new TGLayoutHints(kLHintsCenterX,2,2,2,0));
> m_EB_frame->AddFrame(m_EB_btnframes[1],
> new TGLayoutHints(kLHintsCenterX,2,2,0,2));
> m_eCanvasErrorBanks->Resize(m_eCanvasErrorBanks->GetWidth(),
> m_eCanvasErrorBanks->GetHeight() - 172);
> m_EB_frame->AddFrame(m_eCanvasErrorBanks);
> m_EB_frame->AddFrame(m_EB_btnframes[2],
> new TGLayoutHints(kLHintsCenterX,2,2,2,0));
> m_EB_frame->AddFrame(m_EB_btnframes[3],
> new TGLayoutHints(kLHintsCenterX,2,2,0,2));
>
> Let me know if you need more info.
>
> Thanks a lot.
>
>
>> Cheers, Bertrand.
>>
>>
>> On 5/15/2012 4:39 PM, suvayu ali wrote:
>>> Hi,
>>>
>>> I am working on a GUI written using ROOT. I want to add
>>> TGHorizontalFrames to a tab with other TGHorizontalFrames and a
>>> TRootEmbeddedCanvas depending on context. I try to do this from a method
>>> by calling
>>>
>>> tab->RemoveFrame(canvas);
>>>
>>> horizframe1 = new TGHorizontalFrame(..);
>>> horizframe2 = new TGHorizontalFrame(..);
>>>
>>> tab->AddFrame(horizframe1);
>>> canvas->Resize(origw, origh -<some no>);
>>> tab->AddFrame(canvas);
>>> tab->AddFrame(horizframe2);
>>>
>>> But my problem is the new horizontal frames are positioned at x=0, y=0
>>> and not after the already existing horizontal frame in the tab. I know
>>> this by printing the fames.
>>>
>>> TGCompositeFrame: id=100664561 parent=100663488 x=2 y=23 w=1373
>>> h=566
>>> TGHorizontalFrame: id=100664562 parent=100664561 x=81 y=2 w=1211 h=33
>>> ...
>>> TGHorizontalFrame: id=100665125 parent=100664561 x=0 y=0 w=1211 h=33
>>> ...
>>> TRootEmbeddedCanvas: id=100664582 parent=100664561 x=10 y=47 w=1353
>>> h=337
>>> TGHorizontalFrame: id=100665127 parent=100664561 x=0 y=0 w=1211 h=33
>>> ...
>>>
>>> What am I doing wrong, and where can I find more documentation?
>>>
>>> Thanks,
>>>
>>> PS: This is a GUI used in the LHCb colaboration, so I can't reasonably
>>> simplify the problem into a test macro. I could point you to the
>>> code though.
>>>
>
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
Received on Tue May 15 2012 - 17:10:48 CEST
This archive was generated by hypermail 2.2.0 : Tue May 15 2012 - 17:50:01 CEST