Hi, I just fixed the problem I have found with the dragdrop / clipboard sample (http://rubyforge.org/pipermail/wxruby-development/2009-January/001517.html) : pressing the paste button raises an exception from line #129 of dragdrop.rb related with is_supported method. => The Clipboard#is_supported method now requires an instance of the class DataFormat. I find it tedious to write Wx::DataFormat.new(Wx::DF_TEXT). What about adding constants pointing to instances of DataFormat : - Wx::DataFormat::TEXT # initialized to Wx::DataFormat.new(Wx::DF_TEXT) - Wx::DataFormat::BITMAP # Wx::DataFormat.new(Wx::DF_BITMAP) - ... The naming of these constants is just a proposal. What do you think about that ? Cheers. Chauk-Mean.
Sounds like a good idea to me. On Fri, Jan 23, 2009 at 1:14 PM, Chauk-Mean P <chauk.mean at gmail.com> wrote:> Hi, > > I just fixed the problem I have found with the dragdrop / clipboard > sample ( > http://rubyforge.org/pipermail/wxruby-development/2009-January/001517.html > ) > : > pressing the paste button raises an exception from line #129 of > dragdrop.rb related with is_supported method. > > => The Clipboard#is_supported method now requires an instance of the > class DataFormat. > > I find it tedious to write Wx::DataFormat.new(Wx::DF_TEXT). > What about adding constants pointing to instances of DataFormat : > - Wx::DataFormat::TEXT # initialized to Wx::DataFormat.new(Wx::DF_TEXT) > - Wx::DataFormat::BITMAP # Wx::DataFormat.new(Wx::DF_BITMAP) > - ... > The naming of these constants is just a proposal. > > What do you think about that ? > > Cheers. > > Chauk-Mean. > _______________________________________________ > wxruby-development mailing list > wxruby-development at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-development >-- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-development/attachments/20090123/ede56eea/attachment.html>
Chauk-Mean P wrote:> I just fixed the problem I have found with the dragdrop / clipboard > sample (http://rubyforge.org/pipermail/wxruby-development/2009-January/001517.html) > : >Thanks for the patch> => The Clipboard#is_supported method now requires an instance of the > class DataFormat. > > I find it tedious to write Wx::DataFormat.new(Wx::DF_TEXT). > What about adding constants pointing to instances of DataFormat : > - Wx::DataFormat::TEXT # initialized to Wx::DataFormat.new(Wx::DF_TEXT) > - Wx::DataFormat::BITMAP # Wx::DataFormat.new(Wx::DF_BITMAP)Yes, it is tedious. Before strings and integers were converted by typemaps to a DataFormat object, but I couldn''t get this to work safely and reliably as they passed through all the directors. In C++ it works better because passing wxDF_TEXT is implicitly converted when passed as an arguemnt. I wonder if it would be better for Wx::DF_TEXT to be the actual data format, and then have Wx::DATA_FORMAT_TYPE_TEXT as the integer constant. In most cases the former is more useful, I think, so should have the shorter name. What do you think? a
Hi, 2009/1/26 Alex Fenton <alex at pressure.to>:>> I find it tedious to write Wx::DataFormat.new(Wx::DF_TEXT). >> What about adding constants pointing to instances of DataFormat : >> - Wx::DataFormat::TEXT # initialized to Wx::DataFormat.new(Wx::DF_TEXT) >> - Wx::DataFormat::BITMAP # Wx::DataFormat.new(Wx::DF_BITMAP) > > Yes, it is tedious. Before strings and integers were converted by typemaps > to a DataFormat object, but I couldn''t get this to work safely and reliably > as they passed through all the directors. > > In C++ it works better because passing wxDF_TEXT is implicitly converted > when passed as an arguemnt. > > I wonder if it would be better for Wx::DF_TEXT to be the actual data format, > and then have Wx::DATA_FORMAT_TYPE_TEXT as the integer constant. In most > cases the former is more useful, I think, so should have the shorter name. > > What do you think?Yes, this is definitively the best solution from a user point of view. It will be easier and less confusing for converting C++ code for example if we use Wx::DF_TEXT, Wx::DF_BITMAP ... And in the future, we can continue to use these constants and just change the actual type if SWIG manage safely the type conversion. How do you want to proceed with the corresponding modifications ? Cheers. Chauk-Mean.
Chauk-Mean P wrote:> Yes, this is definitively the best solution from a user point of view. > It will be easier and less confusing for converting C++ code for > example if we use Wx::DF_TEXT, Wx::DF_BITMAP ... > And in the future, we can continue to use these constants and just > change the actual type if SWIG manage safely the type conversion. > > How do you want to proceed with the corresponding modifications ? >I expect the easiest way will be to add the constant type ids in the SWIG file, and then create the DF_ constants in the ruby lib file. I''ll do this when I get a chance to try and fix the clipboard crash on Windows. I just haven''t got round to digging out the old windows laptop with VC 7.1 on it and pointing a debugger at it. alex