librelist archives

« back to archive

stacks, scrollbars, and such

stacks, scrollbars, and such

From:
J. Kaiden
Date:
2011-06-20 @ 21:56
hi all,

  i would like to create a two-paned window, in which the two panes act
independently.  specifically, if the left pane fills up with so much stuff
that it needs a scrollbar, i don't want the right pane to scroll with it.
 i've been fooling around a bunch, but can't seem to make anything work.

  here's a simplified example of what i'm trying to do:
#####
class Browser < Shoes::Widget
 def initialize
@leftpane = stack
@rightpane = stack
@leftpane.style(width: 200, scroll: false)
@rightpane.style(top: 0, scroll: true)
self.fillErUp
end
 def fillErUp
@leftpane.append{para "this is the left side, and i don't want it to
scroll", stroke: red}
@rightpane.append{para "this is the right side, and i do want it to scroll",
stroke: green}
range = 0..100
range.each{|n| @rightpane.append{para n.to_s, stroke: green}}
end
end #class

Shoes.app do
button("browser"){window width: 800 do
browser
end
}
end
######

  seems that the scrollbar gets attached to the window created in the main
Shoes.app and not to the @rightpane stack... i've tried throwing a 'scroll:
false' into the window parameters, but with the same results.

  any ideas how this could be done?

  thanks,

  - j

Re: [shoes] stacks, scrollbars, and such

From:
ashbb
Date:
2011-06-21 @ 12:05
Hi J,

The slot with scroll bar needs to set :width and :height explicitly when you
create the slot initially.

So, try out the following. ;-)

 def initialize
   @leftpane = stack width: 200
   @rightpane = stack width: -200, height: 400, scroll: true
   fillErUp
 end

ps. Incidentally, Green Shoes has not supported the slot with scroll bar.
:-P

ashbb

Re: [shoes] stacks, scrollbars, and such

From:
J. Kaiden
Date:
2011-06-21 @ 12:52
thanks ashbb!

  i had tried setting the height for the @rightpane, but without setting the
width, and it wasn't working - thanks for the help, again!

ps. Incidentally, Green Shoes has not supported the slot with scroll bar.
> :-P
>
> ashbb
>

  noticed that here:  http://ashbb.github.com/green_shoes/Rules.html
  though with the availability of gtk2 widgets, maybe nested Shoes window
slots aren't so important...  i still haven't dived back into trying to
install a more modern gtk2 version which would support green shoes - it was
such a headache last time that i had to reinstall ruby and all the libraries
i use a couple of times!  seems like a very interesting project, and i'm
anxious to fool around with it some...

  thanks again -

  - j