Ignore:
Timestamp:
Mar 19, 2010, 6:50:48 AM (14 years ago)
Author:
ronosman
Message:

Feature 1520 added : ability to set photo default caption after the photo is added.

File:
1 edited

Legend:

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

    r5122 r5184  
    1212use Wx qw( wxALIGN_RIGHT wxALIGN_BOTTOM wxALIGN_CENTER wxALIGN_CENTER_VERTICAL wxALIGN_CENTER_HORIZONTAL );
    1313use Wx qw( wxTR_HAS_BUTTONS wxTR_LINES_AT_ROOT wxSUNKEN_BORDER wxLI_HORIZONTAL wxTE_MULTILINE );
    14 use Wx qw( wxDP_DROPDOWN );
     14use Wx qw( wxDP_DROPDOWN wxCB_READONLY);
    1515
    1616# Bitmap functions
     
    117117    my $topsizer = Wx::BoxSizer->new( wxVERTICAL );
    118118
    119     $topsizer->Add( 
    120         TextField(
     119    $topsizer->Add(
     120        ComboField(
    121121            $parent,
    122122            $main::CAPTION,
     
    314314}
    315315
     316
     317sub ComboField {
     318    my ( $parent, $id_label, $id_ctrl, $expand ) = @_;
     319
     320    $expand ||=0;
     321
     322    my( $sizer ) = Wx::BoxSizer->new( wxVERTICAL );
     323
     324    $expand||=0;
     325   
     326    $sizer->Add(
     327        Wx::StaticText->new(
     328            $parent,
     329            $id_label,
     330            "text",
     331            wxDefaultPosition,
     332            wxDefaultSize,
     333            0
     334        ),
     335        0,
     336        wxALL,
     337        1
     338    );
     339
     340    my $ctrl = Wx::ComboBox->new(
     341        $parent,
     342        $id_ctrl,
     343        "",
     344        wxDefaultPosition,
     345        [-1,-1],
     346        [],
     347       
     348    );
     349
     350    # the EVT_COMBOBOX has set _value if we need to overwrite the default
     351    # text. The list contains function names. We want to have the value returned by the function
     352    # in the text field
     353    Wx::Event::EVT_IDLE(
     354        $ctrl,
     355        sub {
     356            my ( $ctrl, $event ) = @_;
     357            if(exists $ctrl->{_value}){
     358                $ctrl->SetValue($ctrl->{_value}) if !$ctrl->{_multi_selection_mode};
     359                delete $ctrl->{_value};
     360                delete $ctrl->{_multi_selection_mode};
     361            }
     362        }
     363    );
     364
     365
     366    $sizer->Add(
     367        $ctrl,
     368        $expand,
     369        wxEXPAND|wxALL,
     370        1
     371    );
     372
     373
     374
     375    $sizer;
     376}
     377
     378
    316379sub _multi_selection_mode_panel_layout{
    317380    my ( $panel ) = @_;
     
    335398
    336399}
     400
     4011;
     402
Note: See TracChangeset for help on using the changeset viewer.