[ROOT] TGListTree pointer not spatially synced, font related?

From: Brett Viren (bv@bnl.gov)
Date: Mon Jan 27 2003 - 23:00:48 MET


Hi,

I find that when clicking in TGListTree, the location of the pointer
on the screen is different from where the TGListTree thinks it is.
This makes it very difficult to open/close folders as one has to guess
where to click.  

The loss of sync gets worse as one clicks further towards the end of a
long list.  For example, in the attached code, in order to open/close
the last folder ("nine/nine") I must click on "nine/four".

The fonts used apparently affect things.  I normally have the
following in my ~/.rootrc:

Unix.*.Gui.NormalFont:        -adobe-helvetica-medium-r-*-*-18-*-*-*-*-*-iso8859-1
Unix.*.Gui.BoldFont:          -adobe-helvetica-bold-r-*-*-18-*-*-*-*-*-iso8859-1
Unix.*.Gui.SmallFont:         -adobe-helvetica-medium-r-*-*-16-*-*-*-*-*-iso8859-1
Unix.*.Gui.ProportionalFont:  -adobe-courier-medium-r-*-*-18-*-*-*-*-*-iso8859-1

If I take this out, TGListTree behaves normally, even with a very long
list (max_dummy set to 10 in the test code).

-Brett.



// make a longish list tree.  Run via:
// shell> root tt.C++
#include <TGFrame.h>
#include <TGListTree.h>
#include <TGCanvas.h>
#include <iostream>
using namespace std;

TGMainFrame* mf = 0;
const char* label[] = {
    "zero",
    "one",
    "two",
    "three",
    "four",
    "five",
    "six",
    "seven",
    "eight",
    "nine",
    0
};

void tt()
{
    
    mf = new TGMainFrame(gClient->GetRoot(),300,300);

    TGCanvas* can = new TGCanvas(mf,10,10);
    TGListTree* tt = new TGListTree(can,kHorizontalFrame);
    tt->Associate(mf);

    mf->AddFrame(can,new TGLayoutHints(kLHintsExpandX|kLHintsExpandY));
    
    const int max_dummy = 1;
    for (int dummy=0; dummy<max_dummy; ++dummy) {
        for (int j=0; label[j]; ++j) {
            cerr << "Adding: " << label[j] << endl;
            TGListTreeItem* item = tt->AddItem(0,label[j]);
            for (int i=0; label[i]; ++i) {
                tt->AddItem(item,label[i]);
            }
            tt->OpenItem(item);
        }
    }
    
    mf->MapSubwindows();
    cerr << "Mapped sub windows\n";
    mf->Layout();
    cerr << "Layed out\n";
    mf->Resize(mf->GetDefaultSize());
    cerr << "Resized\n";
    mf->MapWindow();
    cerr << "Done\n";
}



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:08 MET