Changeset 5184 for extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm
- Timestamp:
- Mar 19, 2010, 6:50:48 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm
r5041 r5184 46 46 'Wx::CheckBox' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_CHECKBOX( $ctrl, $ctrl, sub { $self->OnCheckBox(@_) } ); }, 47 47 'Wx::DatePickerCtrl' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_DATE_CHANGED( $ctrl, $ctrl, sub { $self->OnDatePicker(@_) } ); }, 48 'Wx::ComboBox' => sub { my ( $ctrl ) = @_; 49 Wx::Event::EVT_COMBOBOX( $ctrl, $ctrl, sub { $self->OnComboBox(@_) } ); 50 Wx::Event::EVT_TEXT( $ctrl, $ctrl, sub { $self->OnComboBoxText(@_) } ); 51 }, 48 52 }; 49 53 … … 83 87 84 88 89 sub OnComboBoxText { 90 my ( $self, $ctrl, $event ) = @_; 91 92 if( exists $ctrl->{_value}){ 93 $event->Skip(1); 94 } 95 else{ 96 my $id = $ctrl->GetId; 97 # change the property value 98 $self->properties->{$id}->{value}->( 99 $event->GetString 100 ) if exists $self->properties->{$id}->{value}; 101 102 # exec the callback 103 $self->properties->{$id}->{frame_callback}->($self, $ctrl, $event) if exists 104 $self->properties->{$id}->{frame_callback}; 105 } 106 107 } 108 109 85 110 # what does happen when the text changes 86 111 sub OnTextCtrl { … … 97 122 $self->properties->{$id}->{frame_callback}; 98 123 99 $event->Skip;100 124 } 101 125 … … 163 187 $event->Skip; 164 188 } 189 190 191 sub OnComboBox { 192 my ( $self, $ctrl, $event ) = @_; 193 194 my $id = $ctrl->GetId; 195 196 $ctrl->{_multi_selection_mode} = $self->properties->{$id}->{multi_selection_mode}->() 197 if exists $self->properties->{$id}->{multi_selection_mode}; 198 199 my $selection = exists $self->properties->{$id}->{string_selection} ? $event->GetString : $event->GetSelection; 200 201 my $value = $self->properties->{$id}->{pre_process}->( $selection ) if exists 202 $self->properties->{$id}->{pre_process}; 203 204 if( exists $self->properties->{$id}->{value} ){ 205 $value = $self->properties->{$id}->{value}->( 206 $value, 207 $selection, 208 ); 209 # the item selected in the list is not the real value 210 # we place here the actual value 211 # to use in EVT_IDLE event, and overwrite the text field with it 212 $ctrl->{_value} = $value; 213 } 214 215 # exec the callback 216 $self->properties->{$id}->{frame_callback}->($self, $ctrl, $event) if exists 217 $self->properties->{$id}->{frame_callback}; 218 } 219 165 220 166 221 sub OnDatePicker { … … 196 251 $ctrl->SetValue($date); 197 252 }, 253 'Wx::ComboBox' => sub { 254 my ($ctrl, $value ) = @_; 255 $ctrl->SetValue($value) ; 256 }, 198 257 }; 199 258 … … 210 269 my $ctrl =$self->FindWindow($_); 211 270 if(defined $ctrl){ 271 #printf("%s\n", $ctrl); 212 272 # checkbox, static text 213 273 $change_value->{ref $ctrl}->( … … 269 329 my ( $self ) = @_; 270 330 271 331 map { 272 332 my $ctrl =$self->FindWindow($_); 273 333 #printf("ctrl %s : %s\n", $_, $ctrl);
Note: See TracChangeset
for help on using the changeset viewer.