Class: Drx::TkGUI::Scrolled
Overview
Wraps scrollbars around a widget.
Instance Method Summary collapse
-
#initialize(parent, the_widget, opts = { :vertical => true, :horizontal => true }) ⇒ Scrolled
constructor
A new instance of Scrolled.
- #raise ⇒ Object
Constructor Details
#initialize(parent, the_widget, opts = { :vertical => true, :horizontal => true }) ⇒ Scrolled
Returns a new instance of Scrolled.
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 |
# File 'lib/drx/tk/app.rb', line 546 def initialize(parent, , opts = { :vertical => true, :horizontal => true }) super(parent) @the_widget = if opts[:vertical] TkScrollbar.new(self) { |s| grid(:row => 0, :column => 1, :rowspan => 1, :columnspan => 1, :sticky => 'news') command { |*args| .yview *args } .yscrollcommand { |first,last| s.set first,last } } end if opts[:horizontal] TkScrollbar.new(self) { |s| orient 'horizontal' grid(:row => 1, :column => 0, :rowspan => 1, :columnspan => 1, :sticky => 'news') command { |*args| .xview *args } .xscrollcommand { |first,last| s.set first,last } } end .raise # Since the frame is created after the widget, it obscures it by default. .grid(:in => self, :row => 0, :column => 0, :rowspan => 1, :columnspan => 1, :sticky => 'news') TkGrid.rowconfigure(self, 0, :weight => 1, :minsize => 0) TkGrid.columnconfigure(self, 0, :weight => 1, :minsize => 0) end |
Instance Method Details
#raise ⇒ Object
569 570 571 572 |
# File 'lib/drx/tk/app.rb', line 569 def raise super @the_widget.raise end |