Logo Search packages:      
Sourcecode: wxwindows2.4 version File versions

def lib::intctrl::wxIntCtrl::Paste (   self  ) 

Override the wxTextCtrl's .Paste function, with our own
that does validation.  Will raise ValueError if not a
valid integerizable value.

Definition at line 808 of file intctrl.py.

00808                      :
        """
        Override the wxTextCtrl's .Paste function, with our own
        that does validation.  Will raise ValueError if not a
        valid integerizable value.
        """
        paste_text = self._getClipboardContents()
        if paste_text:
            # (conversion will raise ValueError if paste isn't legal)
            sel_start, sel_to = self.GetSelection()
            text = wxTextCtrl.GetValue( self )
            new_text = text[:sel_start] + paste_text + text[sel_to:]
            if new_text == '' and self.IsNoneAllowed():
                self.SetValue(None)
            else:
                value = self._fromGUI(new_text)
                self.SetValue(value)
                new_pos = sel_start + len(paste_text)
                wxCallAfter(self.SetInsertionPoint, new_pos)



#===========================================================================

if __name__ == '__main__':


Generated by  Doxygen 1.6.0   Back to index