Ignore:
Timestamp:
Mar 26, 2010, 9:04:59 PM (14 years ago)
Author:
ronosman
Message:

Feature 1539 added : When uploading, display a dialog box with the categories list when no category is selected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm

    r5184 r5390  
    5050                              Wx::Event::EVT_TEXT( $ctrl, $ctrl, sub { $self->OnComboBoxText(@_) } );
    5151                          },
     52        'Uploader::GUI::wxCategoryTreeCtrl' => sub { my ( $ctrl ) = @_;
     53                                                   Wx::Event::EVT_TREE_SEL_CHANGED(
     54                                                       $ctrl,
     55                                                       $ctrl,
     56                                                       sub {
     57                                                           $self->OnCategoryTreeSelChanged(@_);
     58                                                       }
     59                                                   );
     60                                               },
    5261    };
    5362   
    5463    map {
    5564        my $ctrl =$self->FindWindow($_);
     65
    5666        if(defined $ctrl){
    5767            $ctrl_handlers->{ ref $ctrl}->($ctrl) if exists $ctrl_handlers->{ ref $ctrl};
     
    257267};
    258268
     269
     270sub OnCategoryTreeSelChanged {
     271    my ( $self, $ctrl, $event ) = @_;
     272
     273    my $id = $ctrl->GetId;
     274
     275    # change the property value.
     276    $self->properties->{$id}->{id_selection}->(
     277        $event->GetEventObject->GetSelectionsIds
     278    ) if exists $self->properties->{$id}->{id_selection};
     279
     280    #printf("OnCategoryTreeSelChanged %s\n", Dumper $self->properties->{$id}->{id_selection}->());
     281
     282    # exec the callback
     283    $self->properties->{$id}->{frame_callback}->($self, $ctrl, $event) if exists
     284        $self->properties->{$id}->{frame_callback};   
     285   
     286    $event->Skip;
     287}
     288
     289
    259290my $clear_value = {
    260291    'Wx::TextCtrl' => sub { my ($ctrl) = @_; $ctrl->Clear},
    261292    'Wx::CheckBox' => sub { my ($ctrl) = @_; $ctrl->SetValue(0)},
    262293    'Wx::DatePickerCtrl' => sub { my ($ctrl) = @_; $ctrl->SetValue(Wx::DateTime->new->SetToCurrent)},
     294    'Uploader::GUI::wxCategoryTreeCtrl' => sub { my ( $ctrl ) = @_;
     295                                               $ctrl->SelectItem($ctrl->GetRootItem);
     296                                           },
    263297};   
    264298
Note: See TracChangeset for help on using the changeset viewer.