in reply to perl/Tk scrollbar aligning

I'm probably just being thick here but what do you mean by aligning the scrollbar?

Do you want to change the position of the scrollbar in relation to the listbox? In that case change the specification in -scrollbars => 'osoe', for example 'onow' will put scrollbars on the top and left ('north' and 'west') sides of the listbox.

Or did you mean that you want the initial position of the 'slider' (the bit that you can slide around that represent the current view) to be set to the right of your listbox? You might be able to do this by $listbox->xview("moveto,1"), or something similar, I don't have time to test this just now. Have a look at the Tk::Scrollbar perldoc.

Hope that helps.

Kevin O'Rourke

Replies are listed 'Best First'.
Re: Re: perl/Tk scrollbar aligning
by TomK32 (Monk) on Nov 30, 2001 at 20:51 UTC
    I think you meant
    $listbox->yview(3);
    for scrolling down the list, xview() would move it left and it accepts only a integer (btw, it starts with 0 of course)
    -- package Lizard::King; sub can { do { 'anything'} };

      No, I meant $tally_scroll->Subwidget("scrolled")->xview(moveto => 1), to scroll the listbox as far right as possible

      perldoc Tk::Listbox:

      *$listbox*->xview(moveto => *fraction*) Adjusts the view in the window so that *fraction* of the total width of the listbox text is off-screen to the left. *fraction* must be a fraction between 0 and 1.

      Kevin O'Rourke

Re: Re: perl/Tk scrollbar aligning
by maderman (Beadle) on Nov 30, 2001 at 21:59 UTC
    I'm after the second option. However, since I've got a Scrolled widget, accessing the scrollbar might have to be done via the Subwidget method: I can change the colour of the scroll bar:
    $tally_scroll -> Subwidget("xscrollbar") -> configure(-bg => 'blue';
    but how to get the slider move to the right? Dunno yet.
      $tally_scroll->xview(3); will move your list _and_ scrollbar (Don't know if you can move only one) 3 letters to the right.