Hi

I tried to add Radio buttons the notebook example which appears in the
Padre.

but it seems that the handlers doesn't do anything ?
PSB my code

Can somebody help.

Thanks

Lioz


#!/usr/bin/perl
use strict;
use warnings;

#############################################################################
##
##
## Copyright:   (c) The Padre development team
## Licence:     This program is free software; you can redistribute it
and/or
##              modify it under the same terms as Perl itself
#############################################################################
my $app = Demo::ListView->new;
$app->MainLoop;

#####################
package Demo::ListView;
use strict;
use warnings;
use base 'Wx::App';

sub OnInit {
 my $frame = Demo::Frame->new;
 $frame->Show(1);
}
#####################
package Demo::Frame;
use strict;
use warnings;

use Wx ':everything';
use Wx::Event ':everything';
use Wx qw(:radiobutton :font wxDefaultPosition wxDefaultSize);
use Wx::Event qw(EVT_RADIOBUTTON EVT_BUTTON);
use base 'Wx::Frame';
sub new {
 my ($class) = @_;
 my $self = $class->SUPER::new(
  undef,
  -1,
  'Notebook ',
  [ -1,  -1 ],
  [ 750, 700 ],
 );


 #
 # Creating the notebook with tabs (also called panes)
 my $nb = Wx::Notebook->new(
  $self, -1, wxDefaultPosition, wxDefaultSize,
  wxNO_FULL_REPAINT_ON_RESIZE | wxCLIP_CHILDREN

 );
        my $rb11 = Wx::RadioButton->new( $nb, -1, "Radio&10,300",
                                    [10, 300], wxDefaultSize,,wxRB_GROUP );
       my $rb21 = Wx::RadioButton->new( $nb, -1, "Radio&20,300",
                                    [10, 330], wxDefaultSize, wxRB_GROUP
);

 # creating the content of the first tab
 my $editor = Wx::TextCtrl->new(
  $nb, -1, '', Wx::wxDefaultPosition, Wx::wxDefaultSize,
  wxTE_MULTILINE | wxNO_FULL_REPAINT_ON_RESIZE
 );
 # add first tab
      $nb->AddPage( $editor, 'Editor', 0);
      $rb11->SetValue(0);
      $rb21->SetValue(0);

 my $choices = [
  'This example', 'was borrowed',
  'from an example', 'Hi David ', 'How are you ?'
 ];
 my $listbox = Wx::ListBox->new( $nb, -1, Wx::wxDefaultPosition,
Wx::wxDefaultSize, $choices );
 $nb->AddPage( $listbox, 'Listbox', 1 );
 EVT_LISTBOX_DCLICK( $self, $listbox, \&on_listbox_double_click );
        EVT_BUTTON( $self, $rb11, \& OnRadioButton_Sel1);
        EVT_BUTTON( $self, $rb21, \&OnRadioButton_Sel2 );
 return $self;
}

sub OnRadio {
    my( $self, $event ) = @_;
    Wx::LogMessage( join '', "RadioButton selection string is: ",
                              $event->GetEventObject->GetLabel );
}
sub OnRadioButton_Sel1 {
    my( $self, $event ) = @_;
     $self->lb->rb11->SetValue( 1 );
      Wx::LogMessage( join '', "RadioButton selection string is: ",
                              $event->GetEventObject->GetLabel );


}
sub OnRadioButton_Sel2 {
    my( $self, $event ) = @_;
    exit();
    $self->radiobut1_2->SetValue( 1 );


}

sub on_listbox_double_click {
 my ( $self, $event ) = @_;
 Wx::MessageBox( "Double clicked: '" . $event->GetString() . "'", '',
Wx::wxOK | Wx::wxCENTRE, $self );
}

Reply via email to