Ruby/tk and paned widget question

Discussion in 'Ruby' started by Nigel Wilkinson, Oct 19, 2004.

  1. Hi all

    I can create this with

    a=TkPanedWindow.new

    how do I add childsites, I've tried a.add(left) and thigs like it but can't
    find the right one

    Cheers
    Nigel
    Nigel Wilkinson, Oct 19, 2004
    #1
    1. Advertising

  2. Nigel Wilkinson

    Phlip Guest

    Phlip, Oct 19, 2004
    #2
    1. Advertising

  3. > Post more complete code. You might be missing a grid() (which is better
    > than pack()).



    OK, here's the panedwindow code


    horizsplit = TkPanedWindow.new(parent) {
    orient 'vertical'
    }
    horizsplit.add(left)
    horizsplit.add(right)
    horizsplit.pack( 'fill' => 'both' )


    Its failing saying that

    undefined local variable or method `left' for #<MainGUI:0x403949e8>
    (NameError)

    Thanks
    Nigel
    Nigel Wilkinson, Oct 19, 2004
    #3
  4. Hi,

    From: Nigel Wilkinson <>
    Subject: Re: Ruby/tk and paned widget question
    Date: Wed, 20 Oct 2004 07:35:47 +0900
    Message-ID: <>
    > horizsplit = TkPanedWindow.new(parent) {
    > orient 'vertical'
    > }


    Do you really want to set "vertical"?
    If "orient" option is "vertical", widgets are stacked vertically
    in the panedwindow.
    The words, "horizsplit", "left" and "right", don't denote "vertical stack".

    > horizsplit.add(left)
    > horizsplit.add(right)
    > horizsplit.pack( 'fill' => 'both' )


    You must give widgets for TkPanedWindow#add.
    For example,

    horizsplit = TkPanedWindow.new(parent, :eek:rient=>:horizontal){
    add(TkListbox.new(horizsplit).insert:)end, 'lbox1'))
    add(TkListbox.new(horizsplit).insert:)end, 'lbox2'))
    add(TkListbox.new(horizsplit).insert:)end, 'lbox3'))

    pack:)fill=>:both, :expand=>true)
    }
    horizsplit.panes.each_with_index{|lbox, idx| lbox.insert:)end, idx)}

    --
    Hidetoshi Nagai ()
    Hidetoshi NAGAI, Oct 20, 2004
    #4
  5. --On Wednesday, October 20, 2004 08:02:41 +0900 Hidetoshi NAGAI
    <> wrote:

    > Hi,
    >
    > From: Nigel Wilkinson <>
    > Subject: Re: Ruby/tk and paned widget question
    > Date: Wed, 20 Oct 2004 07:35:47 +0900
    > Message-ID: <>
    >> horizsplit = TkPanedWindow.new(parent) {
    >> orient 'vertical'
    >> }

    >
    > Do you really want to set "vertical"?
    > If "orient" option is "vertical", widgets are stacked vertically
    > in the panedwindow.
    > The words, "horizsplit", "left" and "right", don't denote "vertical
    > stack".
    >
    >> horizsplit.add(left)
    >> horizsplit.add(right)
    >> horizsplit.pack( 'fill' => 'both' )

    >
    > You must give widgets for TkPanedWindow#add.
    > For example,
    >
    > horizsplit = TkPanedWindow.new(parent, :eek:rient=>:horizontal){
    > add(TkListbox.new(horizsplit).insert:)end, 'lbox1'))
    > add(TkListbox.new(horizsplit).insert:)end, 'lbox2'))
    > add(TkListbox.new(horizsplit).insert:)end, 'lbox3'))
    >
    > pack:)fill=>:both, :expand=>true)
    > }
    > horizsplit.panes.each_with_index{|lbox, idx| lbox.insert:)end, idx)}
    >
    > --
    > Hidetoshi Nagai ()
    >


    Thanks for that, it works a treat. Please excuse my elementary ignorance
    but I'm trying to teach myself some programing and am new to everything and
    trying to piece it together from what documentation there is.

    Thanks again
    Nigel
    Nigel Wilkinson, Oct 20, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Basile STARYNKEVITCH
    Replies:
    0
    Views:
    324
    Basile STARYNKEVITCH
    Sep 2, 2003
  2. Replies:
    0
    Views:
    331
  3. Frederic Rentsch
    Replies:
    0
    Views:
    234
    Frederic Rentsch
    Jul 8, 2012
  4. Terry Reedy
    Replies:
    15
    Views:
    630
    Frederic Rentsch
    Jul 16, 2012
  5. Frederic Rentsch
    Replies:
    0
    Views:
    426
    Frederic Rentsch
    Jul 9, 2012
Loading...

Share This Page