Problem with the size of notebook pages

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 :frowning: 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 !

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

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…

You’re welcome

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs