carno has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk::Hlist header callbacks
by rcseege (Pilgrim) on Sep 05, 2006 at 03:39 UTC | |
HList headers cannot receive events in a useful way and there are no HList-specific callbacks that will do what you are looking for. What is possible is to embed a widget within each header (though to be excruciatingly accurate it actually floats above the header), and bind to the embedded widgets -- not the header. You might also take a look at Tk::ResizeButton, which can be found on CPAN. The following example was culled from one of my posts from the c.l.p.tk archives from back in 2001. I'm certain that there are other related examples to be found there as well.:
Some more comments from the same post: Note the borderwidth of -2 for the headerCreate method. This is something I found by trial and error. I did not want there to be a borderwidth on both the button AND the header that HList creates, but if you don't set this value, then you will get both. Also note that you are almost guaranteed to have a small section of space left after the the last header. I know of at least one way to "sort of" get around this. You can add an extra column in the HList widget that you don't use. It looks as though there is an empty header (unclickable of course) which fills up the remaining space. This is a similar approach that I've seen in some Windows GUI's. You might also try resizing columns if the detect that the widget has been resized (bind to configure event, and compare reqWith reqHeight, etc), then adjust column sizes to whatever is appropriate. In the past, what I have done is to embed a Frame widget which had "handles" (another frame widget) that I could use to enlarge/shrink column widths. A user would drag the handle causing a floating frame above the HList to show where the new column should be, and when the mouse was released, the column would be resized. There are plenty of things you can use HList for, but I would be caution you against using very large datasets. I started noticing slowness at 10K or more cells when updating sorts. For large data sets, I'd recommend Tk::TableMatrix. Similar techniques can be applied to it. HTH, Rob | [reply] [d/l] |
|
Re: Tk::Hlist header callbacks
by jdtoronto (Prior) on Sep 05, 2006 at 01:31 UTC | |
| [reply] |
|
Re: Tk::Hlist header callbacks
by zentara (Cardinal) on Sep 05, 2006 at 12:12 UTC | |
I'm not really a human, but I play one on earth. Cogito ergo sum a bum | [reply] [d/l] |
by Anonymous Monk on Sep 06, 2006 at 03:31 UTC | |
| [reply] |
by Anonymous Monk on Sep 09, 2006 at 17:49 UTC | |
Tk::DBI::Table looks like it would work for most things and I'll definitely be using it in the future, but it didn't handle my hierarchy quite the way I needed - probably could be solved with some mysql code to set up a unique index field, but I'm not yet familiar enough with mysql to do that. Many thanks again for the suggestions. | [reply] |
|
Re: Tk::Hlist header callbacks
by GrandFather (Saint) on Sep 04, 2006 at 21:54 UTC | |
What are you actually trying to do with the header? Drag columns perhaps? DWIM is Perl's answer to Gödel | [reply] |
by carno (Initiate) on Sep 04, 2006 at 23:03 UTC | |
| [reply] |