Forum: wxRuby problem with the size of notebook pages

5ef49c8801b17e6d487d83540bb19052?d=identicon&s=25 Sylvain Dubus (korangar)
on 2010-04-05 10:20
Attachment: notebook.png (4 KB)
Hi here,

I have to make a school project in wxRuby and since 1-2 weeks, i am
completely blocked because of a notebook display problem.

I don't manage to adapt the size of notebook pages with the content. The
size is completely fixed, and so what is inside is cut. And when I try
to modify the size, it changes nothing :( Here a part of my notebook
class :


  def initialize(parent)
    super(parent, -1, Wx::DEFAULT_POSITION)
  end

  def create_contact_page()
          @contacts = Wx::Panel.new(self, :size => [-1, 500])
                # the size parameter changes nothing

                @contacts_box = Wx::BoxSizer.new(Wx::VERTICAL)

    @label_contact_list = Wx::StaticText.new(@contacts, :label =>
"Contact list :")
    @contacts_box.add(@label_contact_list, 1, Wx::ALL, 15)

    @contacts.set_sizer(@contacts_box)

    self.add_page(@contacts, "My contacts")
  end


I've linked the result in attachment.

Thank you for your help !
2aa32559134aa3d596fb749f8ffccde7?d=identicon&s=25 hendra kusuma (Guest)
on 2010-04-05 10:56
(Received via mailing list)
I cannot help with your code
but my code is working
see if this code helps you
good luck

require 'rubygems'
require 'wx'
class Notebook_b < Wx::Frame
    include Wx
    def initialize(parent=nil)
        super parent, -1, "Notebook", DEFAULT_POSITION,
Size.new(600,400),
DEFAULT_FRAME_STYLE
        @statusbar = StatusBar.new(self, -1)
        self.set_status_bar(@statusbar)
        @statusbar.set_status_text ""
        @notebook_101 = Notebook.new(self, -1, DEFAULT_POSITION,
DEFAULT_SIZE, NB_TOP)
        @panel_102 = Panel.new(@notebook_101, -1)
        @flexgridsizer_103 = FlexGridSizer.new( 0, 1, 5, 5 )
        @flexgridsizer_103.add_growable_col 0
        @static_text_104 = StaticText.new(@panel_102, -1, "hello world",
DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_LEFT)
        @flexgridsizer_103.add(@static_text_104, 0, Wx::ALL |
Wx::ALIGN_LEFT
| Wx::ALIGN_TOP  | Wx::EXPAND )
        @panel_102.set_sizer( @flexgridsizer_103 )
        @notebook_101.add_page @panel_102, "My Tab"

        evt_close{ |event| on_close(event) }
        on_load()
    end

    def on_close(event)
        event.skip
    end

    def on_load()
    end
end
5ef49c8801b17e6d487d83540bb19052?d=identicon&s=25 Sylvain Dubus (korangar)
on 2010-04-05 14:28
hendra kusuma wrote:
> I cannot help with your code
> but my code is working
> see if this code helps you
> good luck

Thank you Hendra, I tried your code and I had the same problem. So I
understood that it was not the notebook that was bugging, but something
else. Finally, the problem is where I add the notebook to my main
boxsizer.
I forgot to put the proportion parameter to 1 !! It was at 0 so it took
the smallest possible place...
2aa32559134aa3d596fb749f8ffccde7?d=identicon&s=25 hendra kusuma (Guest)
on 2010-04-06 10:10
(Received via mailing list)
You're welcome
This topic is locked and can not be replied to.