Hi Patrick,

On 21-10-2014 17:06, Patrick via RT wrote:
  When I create a wxSingleChoiceDialog, that does show up as a child.  Why is 
the handling of these two different?
Well, the implementation of the wxSingleChoiceDialog is much more complicated. You can look in wxPerl::XS. Here isTextEntryBox:

   wxTextEntryDialog::new( parent, message, caption =
   wxGetTextFromUserPromptStr, defaultValue = wxEmptyString, style =
   wxTextEntryDialogStyle, pos = wxDefaultPosition )
        wxWindow* parent
        wxString message
        wxString caption
        wxString defaultValue
        long style
        wxPoint pos


and here is wxSingleChoiceDialog:

   wxSingleChoiceDialog::new( parent, message, caption, chs, dt =
   &PL_sv_undef, style = wxCHOICEDLG_STYLE, pos = wxDefaultPosition )
        wxWindow* parent
        wxString message
        wxString caption
        SV* chs
        SV* dt
        long style
        wxPoint pos
      PREINIT:
        wxString* choices;
        SV** data;
        int n, n2;
      CODE:
        n = wxPli_av_2_stringarray( aTHX_ chs, &choices );
        if( !SvOK( dt ) )
        {
          RETVAL = new wxPliSingleChoiceDialog( parent, message,
   caption, n,
                choices, 0, style, pos );
        }
        else
        {
          n2 = wxPli_av_2_svarray( aTHX_ dt, &data );
          if( n != n2 )
          {
            delete[] choices;
            delete[] data;
            choices = 0; data = 0; n = 0;
            croak( "supplied arrays of different size" );
          }
          RETVAL = new wxPliSingleChoiceDialog( parent, message,
   caption, n,
                choices, data, style, pos );
          delete[] data;
        }
        delete[] choices;
      OUTPUT:
        RETVAL

wxSingleChoiceDialog has a whole new .cpp function (wxPliSingleChoiceDialog) written within wxPerl. It also has a destructor there. It is one of only 7 .cpps. It's not clear to me how the destructor it is called, but the two functions are implemented very differently.

It would be good to understand why they are different and bring them into line with each other.

Regards,

Steve.





Reply via email to