[fxruby-users] A way to record the splitter positions

Joey Kinsella jkinsella at ancillaryservices.com
Mon Jul 19 14:38:50 EDT 2010


I don't believe there is a "generic" way. However something like this should
work:

#! /usr/bin/env ruby

require 'fox16'
include Fox

class ExampleApp < FXMainWindow

  def initialize(app)
    super(app, "Example Application", :opts => DECOR_ALL, :width => 800,
      :height => 600)

    @registry = app.reg()
    @split = []

    @split[0] = @registry.readIntEntry("splitter", "split0", 124)
    @split[1] = @registry.readIntEntry("splitter", "split1", 674)
  end

  def create
    draw_gui

    super
    show(PLACEMENT_SCREEN)
  end

  def draw_gui
    split = FXSplitter.new(self, LAYOUT_FILL | SPLITTER_NORMAL |
      SPLITTER_TRACKING)

    b1 = FXButton.new(split, "Button 1", :opts => BUTTON_NORMAL |
LAYOUT_FILL)
    b2 = FXButton.new(split, "Button 2", :opts => BUTTON_NORMAL |
LAYOUT_FILL)

    split.connect(SEL_COMMAND) do
      @registry.writeIntEntry("splitter", "split0", split.getSplit(0))
      @registry.writeIntEntry("splitter", "split1", split.getSplit(0))
    end

    @split.each_index do |i|
      split.setSplit(i, @split[i])
    end
  end
end

if __FILE__ == $0
  app = FXApp.new("example", "example")
  app.init(ARGV)

  win = ExampleApp.new(app)
  app.create
  app.run
end

On Mon, Jul 19, 2010 at 2:06 PM, Ralph Shnelvar <ralphs at dos32.com> wrote:

>  Is there a generic way of recording the splitter position(s) and throwing
> them at the registry?
>
> _______________________________________________
> fxruby-users mailing list
> fxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/fxruby-users
>

--
If you are not the intended recipient, you are hereby notified
that any dissemination, distribution, copying or other use of
this communication is strictly prohibited.  If you have
received this communication in error, please notify us
immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100719/5b6a6160/attachment.html>


More information about the fxruby-users mailing list