Hello Ilka and others,
I tried to use kFitWidth, but it doesnt seem to work … maybe I am doing something worng. Here is a macro that reproduces my problem.
there is a TGVSplitter on the right side of the TGShutter frame. If you move it to the right TGTextEnry will increase its width, but then when you reduce the width of the shutter frame the textentry frame doesnt change its width.
-Aram.
//-----------------------
class TestTextEntry
{
TGMainFrame* fMain;
TGVSplitter* vSplitter;
TGTextEntry* fTxt;
TGHorizontalFrame* hframe;
TGCompositeFrame* cvframe1;
TGCompositeFrame* cvframe2;
public:
TestTextEntry(const TGWindow* p, UInt_t w, UInt_t h);
virtual ~TestTextEntry();
};
TestTextEntry::TestTextEntry(const TGWindow* p, UInt_t w, UInt_t h)
{
fMain = new TGMainFrame(p, w, h);
hframe = new TGHorizontalFrame(fMain, 800, 600);
fMain->AddFrame(hframe, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 1, 1, 1, 1));
cvframe1 = new TGCompositeFrame(hframe, 400, 600, kVerticalFrame | kFixedWidth);
hframe->AddFrame(cvframe1, new TGLayoutHints(kLHintsExpandY, 1, 1, 1, 1));
vSplitter = new TGVSplitter(hframe);
vSplitter->SetFrame(cvframe1, kTRUE);
hframe->AddFrame(vSplitter, new TGLayoutHints(kLHintsLeft | kLHintsExpandY));
fShutter= new TGShutter(cvframe1, kSunkenFrame /| kFitWidth/);
cvframe1->AddFrame(fShutter, new TGLayoutHints(kLHintsExpandY | kLHintsExpandX, 1, 1, 1, 1));
fItem = new TGShutterItem(fShutter, new TGHotString(“Shutter Item”), 1/, kFitWidth/);
TGCompositeFrame *container1 = (TGCompositeFrame *) fItem->GetContainer();
fShutter->AddItem(fItem);
fTxt = new TGTextEntry(container1, fBuff = new TGTextBuffer(100), kFitWidth);
fL = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 10, 1, 1, 18 );
container1->AddFrame(fTxt, fL);
bt_exit1 = new TGTextButton(container1, “&Exit”,“gApplication->Terminate(0)”);
container1->AddFrame(bt_exit1, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
cvframe2 = new TGCompositeFrame(hframe, 400, 600, kVerticalFrame);
hframe->AddFrame(cvframe2, new TGLayoutHints(kLHintsTop | kLHintsRight | kLHintsExpandX | kLHintsExpandY , 5, 5, 5, 5));
bt_exit = new TGTextButton(cvframe2, “&Exit”,“gApplication->Terminate(0)”);
cvframe2->AddFrame(bt_exit, new TGLayoutHints(kLHintsBottom | kLHintsCenterX | kLHintsExpandX, 3, 3, 3, 3));
fMain->SetWindowName(“title”);
fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
//Map main frame
fMain->MapWindow();
}
TestTextEntry::~TestTextEntry()
{
fMain->Cleanup();
delete fMain;
}
void testtextentry()
{
new TestTextEntry(gClient->GetRoot(), 800, 600);
}
//-----------------------------------------