aviw has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

We are using perltk in our application for gui. I would like to have 2 frames with a sash so user could give more space to each side.
The part I'm interested is exposing & hiding one of the frames so it will have a sliding windows effect.

When searching found the PaneWindow and moving the sash using sashPlace() is what I look for, BUT it rerenders the other frame it holds and that looks ~not cool.

1. What would be the correct way to do what I want "show hide is a sliding gracefully moving of sash sort and exposing the hidden frame?" using perltk?

2. Is there a way to rerender only one part of the panewindow?

3. Would you recommend other ui?

Thanks.

Replies are listed 'Best First'.
Re: tk sash slide render
by kcott (Archbishop) on Dec 15, 2016 at 05:27 UTC

    G'day aviw,

    Welcome to the Monastery.

    [As you can see from previous replies, your post wasn't very clear with respect to what you're trying to achieve or, indeed, what you've already attempted. While I appreciate that this is your first post, you need to understand that we can only provide advice based on the information you give us. Please provide: the actual names of modules you're using with links to them; a short piece of code that reproduces your problem (and please don't obscure the problem with irrelevant font, colour, border, style, etc. inclusions); and, especially for GUIs, a small piece of ASCII art to demonstrate what you hope to finally see can be particularly useful. See "How do I post a question effectively?", "Writeup Formatting Tips" and "What shortcuts can I use for linking to other information?" for more on these topics.]

    My initial thought (and I wasn't alone in this), was that "PaneWindow" referred to Tk::Pane. I suspect this isn't what you're using (given it doesn't have a sashPlace() method); however, it may do what you want. Try creating a scrolled version (see Tk::Scrolled); however, don't add actual scrollbars, instead control the scrolling using the xview() method. Do note that the scrolling functionality is somewhat limited and may not do everything you want.

    I suspect "PaneWindow" really referred to Tk::Panedwindow. While this does have a sashPlace() method, its DESCRIPTION states:

    "Moving a sash causes the widgets on either side of the sash to be resized."

    So it would appear that's not the widget for your needs.

    What I think may be the best option for you is Tk::Canvas. Probably the most relevant options are: -xscrollcommand, -confine, -height, -scrollregion, -width and -xscrollincrement. And, similarly, these methods: bbox(), xview(), xviewMoveto() and xviewScroll(); and perhaps even scanMark() and scanDragto(). You'll want to set this up as scrolled but without scrollbars, controlling scrolling through options and methods (much as described for Tk::Pane, above).

    Tk::Canvas is part of the standard Tk Distribution. If you run the Widget Demo (just type widget from the command line), you'll find eight examples in the Canvases section which may give you some ideas. There are other, user-contributed canvas widgets which may be better suited to your needs: Tk::WorldCanvas and Tk::Zinc are two examples you might like to look at (those are just examples, not recommendations); or search CPAN for more (there's quite a lot).

    If you want vertical scrolling, every -xoption and xmethod() mentioned above has a complementary -yoption and ymethod(). And, in case you didn't know, Standard Options are described in Tk::options.

    — Ken

Re: tk sash slide render
by Marshall (Canon) on Dec 14, 2016 at 20:39 UTC
    I am not sure that Tk:Pane is what you need or indeed if that is what you are using?

    It would be very helpful if you could post a very simple example of code that demos what is going on.

    Update: With Tk, I almost always use the pack windows manager (pack of the possibilities of: pack, grid, place).

Re: tk sash slide render
by Anonymous Monk on Dec 14, 2016 at 07:08 UTC

    BUT it rerenders the other frame it holds and that looks ~not cool.

    what do you mean by that?

      Thank you for the replay.

      TOP level:

      I mean that what I see is an ugly flashing of re-rendering buttons.

      Detail:

      To create the sliding window effect I've used a timer with 10 mSec interval to call the function which sets the sashPlace() location. The sash moves as expected but the re-rendering causing flashing of the elements.

        What should happen instead?