Ruby/tk and paned widget question

N

Nigel Wilkinson

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
 
P

Phlip

Nigel said:
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

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

Nigel Wilkinson

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
 
H

Hidetoshi NAGAI

Hi,

From: Nigel Wilkinson <[email protected]>
Subject: Re: Ruby/tk and paned widget question
Date: Wed, 20 Oct 2004 07:35:47 +0900
Message-ID: said:
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)}
 
N

Nigel Wilkinson

--On Wednesday, October 20, 2004 08:02:41 +0900 Hidetoshi NAGAI
Hi,

From: Nigel Wilkinson <[email protected]>
Subject: Re: Ruby/tk and paned widget question
Date: Wed, 20 Oct 2004 07:35:47 +0900


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".


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)}

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top