Hi, 

From: "Kujawa, Greg" <Greg.Kujawa / DiamondCellar.com>
Subject: Ruby/TK Question
Date: Fri, 5 Nov 2004 02:09:08 +0900
Message-ID: <B058578D93B5D41193840090276AA76769F967 / DIAMOND_EX>
> The application is for a survey. I have created an initial window where the
> survey taker signs in. They select their name from a TkListbox object. When
> they click on a TkButton object the sign in window exits and I record the
> appropriate current selection of the listbox object.

I recommend you to define a binding to the listbox for more
comfortable UI. ;-)  For example, 
----------------------------------------------------------
$empListbox..bind('Double-Button-1', proc{button.invoke})
----------------------------------------------------------

> My question is how would I go about creating a new window for taking survey
> itself and still keep the saved selection of the listbox object?

Please use the TkToplevel class. It creates a new window object. 
Because the window depends on the root (or its parent) widget, 
when the root widget is destroyed, the window is destroyed too. 
If you want to hide the root widget, use {TkRoot/TkToplevel}#withdraw 
and deiconify method. 

> # Add the sign in button
> button = TkButton.new(@root) { text "Sign me in!" 
> command proc {
>     indexstr = $empListbox.curselection.to_s; 
>     indexnum = indexstr.to_i;
>     $taker=$employee[indexnum].to_s;
>     p $taker;
>     exit

Probably, this 'exit' exits the application. 

-- 
                                  Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)