logo       

Re: help with a script: msg#00040

Subject: Re: help with a script
Hi, Paul,

I'm a begginer, too, but the wizards are shy so I'll
have to speak. 

Here is what i'll do. I don't guarantee that it's the
best way :)

sub pop_up_window {

   my $vbox;
   my $label;
   my $frame;

   ## Create the window # and make it a local variable

   my  $window = new Gtk::Window( "dialog" );

   # and better change it's name, to avoid geting  
   # confused later: your $window from &pop_up_window
   # was actually the main $window, if I am not 
   # mistaken

   $window->signal_connect("destroy",
                           sub {$window->destroy();});
   #
   # I guess that sub { Gtk->exit( 0 ); } terminates 
   # the program

   $window->set_usize( 200, 100 );
   $window->border_width( 10 );

   $vbox = new Gtk::VBox( $false, 5 );

   $window->add( $vbox );

   $label = new Gtk::Label( "label in a popup " );
   $frame = new Gtk::Frame();
   $frame->add( $label );
   $vbox->pack_start( $frame, $false, $false, 0 );

   $button = new Gtk::Button( "Close" );
   $vbox->pack_start( $button, $true, $true, 0 );
   # XXXX
   #this sends the data
   $button->signal_connect( "pressed", 
                            \&some_callback,
                            $some_data);
   #this destroys the dialog
   $button->signal_connect("released",
                           sub {$window->destroy();});
   $button->show();


   $window->show_all();
}

sub some_callback
{
    my ($widget, $hungry_variable) = @_;

    # and here you do something with    
    # $hungry_variable ...   
    # I don't think it made sense to return (0)
    # in &pop_up_window, because there was no
    # $global_hungry_var = &pop_up_window
    # in the main part of the script
    # 
}


I am quite convinced that this is not the best way,
but it might work :)

best luck with Gtk-perl,
Emil

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe