Hello, I am trying to implement a drag from the browser address bar (favicon) and drop onto a wxRuby app. I cannot for the life of me figure out how to set the drop target to accept the URL data type? Any help or pointers appreciated... I implemented file drop with no issues but the url thing has me stumped. John Purrier email: john@junqbox.com <mailto:john@junqbox.com> web: www.junqbox.com _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
John, Is this with wxRuby2? Can you send us some sample code to look at? A brief look at the docs indicates you''ll need to derive your own DropTarget descendant. We''re all pretty caught up in getting the alpha release out so if you can save us all some time with some sample code it would help. Roy John Purrier (JunqBox) wrote:> > Hello, I am trying to implement a drag from the browser address bar > (favicon) and drop onto a wxRuby app. I cannot for the life of me > figure out how to set the drop target to accept the URL data type? Any > help or pointers appreciated? I implemented file drop with no issues > but the url thing has me stumped. > > //John Purrier// > > //email:// john at junqbox.com <mailto:john at junqbox.com> > > //web: //www.junqbox.com <http://www.junqbox.com> > > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
Hi John John Purrier (JunqBox) wrote:> > I cannot for the life of me figure out how to set the drop target to > accept the URL data type? Any help or pointers appreciated? I > implemented file drop with no issues but the url thing has me stumped. >There is an example in the WxWidgets book of creating a custom drop target that accepts URLs. The book is available as a free download, and the reference is on pp299-300 http://www.phptr.com/content/images/0131473816/downloads/0131473816_book.pdf The code is in C++ but I hope it might give you some ideas of how to proceed. Basically you create a DropTarget that accepts an URLDataObject (you may have to create such a class yourself - it appears to be new in WxWidgets 2.7.0). I assume that you''re using wxruby 0.6.0 since drag''n''drop and clipboard isn''t yet in wxruby2. Still, as Roy says, it''d be great if you could forward a simple example to help us add these features to the development version. I''ve been chipping away at adding these features sporadically for a month or two but some way from being ready. If anyone is interested at having a shot I can forward my progress to date. It''d be good stuff to include, and needed for wxruby2''s completeness relative to 0.6.0 cheers alex
Thanks, this is just the info I was looking for. I am using 0.6.0 and was hoping that someone had already implemented the URLDataObject class. The example referenced below from the WxWidgets book is the model I am trying to implement :-). If anyone has code showing a custom drop target class I would appreciate it. When I get the URL stuff working I''ll let you guys know and post the code. John>Hi John > >John Purrier (JunqBox) wrote: >> >> I cannot for the life of me figure out how to set the drop target to >> accept the URL data type? Any help or pointers appreciated... I >> implemented file drop with no issues but the url thing has mestumped.>> >There is an example in the WxWidgets book of creating a custom drop >target that accepts URLs. The book is available as a free download, and>the reference is on pp299-300 > >http://www.phptr.com/content/images/0131473816/downloads/0131473816_book.pdf> >The code is in C++ but I hope it might give you some ideas of how to >proceed. Basically you create a DropTarget that accepts anURLDataObject>(you may have to create such a class yourself - it appears to be new in>WxWidgets 2.7.0). > >I assume that you''re using wxruby 0.6.0 since drag''n''drop and clipboard>isn''t yet in wxruby2. Still, as Roy says, it''d be great if you could >forward a simple example to help us add these features to the >development version. > >I''ve been chipping away at adding these features sporadically for a >month or two but some way from being ready. If anyone is interested at >having a shot I can forward my progress to date. It''d be good stuff to >include, and needed for wxruby2''s completeness relative to 0.6.0 > >cheers >alex-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20060901/ad041fad/attachment.html
John Purrier (JunqBox) wrote:> Thanks, this is just the info I was looking for. I am using 0.6.0 > and was hoping that someone had already implemented the URLDataObject > class.I had a look at the wxWidgets source and also the wxPython URLDataObject implementation. It looks like UDO is just a TextDataObject, with the method GetURL an alias for GetText. TDO is supported in 0.6.0 - so you may be able to get to where you want by getting a TDO from the DropTarget and extracting the URL from it. Or this may not work at all - either way it would be interesting to know. Sorry I can''t be more help trying stuff out right now - but this is up on my priorities for wxruby2 development. cheers a