Hello, wxruby-users. This is an addition which implement wrapper for overloading wxHtmlWindow::OnLinkClicked method. Unfortunately, it was impossible to make it correctly without ugly hack to wxpp.rb, but i`m hope it does not broke it. Please look at attachment for a patch for htmlwindow.t and wxpp.rb and additional file htmllinkinfo.t (need to be added to $objs array in extconf.rb). Sample code of fancy about dialog for windows (for windows -- because of using function from shell32.dll to call favorite email client and favorite browser): ====================================================require ''Win32API'' require ''wxruby'' class WrappedHtml < Wx::HtmlWindow def initialize(*args) super @shell = Win32API.new(''shell32'', ''ShellExecute'', ''LPPPPI'', ''L'') end def on_link_clicked(link) @shell.call 0, ''open'', link.get_href, nil, nil, 1 end end class App < Wx::App def on_init dialog = Wx::Dialog.new nil, -1, ''About'' sizer = Wx::BoxSizer.new Wx::VERTICAL dialog.set_sizer sizer html = WrappedHtml.new dialog, -1 html.set_page <<EOF <html> <body> <a href="http://favicon.ru/en/">My wife web project</a><br /> <a href="mailto:dmiceman@mail.ru">mail me</a><br /> </body> </html> EOF sizer.add html, 1, Wx::EXPAND dialog.set_size Wx::Size.new(400, 300) dialog.center_on_screen Wx::BOTH dialog.show true dialog.evt_close do exit_main_loop end end end app = App.new app.main_loop ==================================================== -- Dmitry mailto:dmiceman@ubiz.ru _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
Thanks for the contributions. I''ll try to get them in this weekend, though the 10 hour workdays have been prohibitive. I''m glad for all the contributions, but I''d appricate if you focused on the SWIG code. You don''t SWIG/Rake/etc to build it - you can use the extconf.rb in the src directory. Nick Dmitry Morozhnikov wrote:> Hello, wxruby-users. > > This is an addition which implement wrapper for > overloading wxHtmlWindow::OnLinkClicked method. Unfortunately, it was > impossible to make it correctly without ugly hack to wxpp.rb, but i`m > hope it does not broke it. > > Please look at attachment for a patch for htmlwindow.t and wxpp.rb and > additional file htmllinkinfo.t (need to be added to $objs array in > extconf.rb). > > Sample code of fancy about dialog for windows (for windows -- because > of using function from shell32.dll to call favorite email client and > favorite browser): > > ====================================================> require ''Win32API'' > require ''wxruby'' > class WrappedHtml < Wx::HtmlWindow > def initialize(*args) > super > @shell = Win32API.new(''shell32'', ''ShellExecute'', ''LPPPPI'', ''L'') > end > def on_link_clicked(link) > @shell.call 0, ''open'', link.get_href, nil, nil, 1 > end > end > class App < Wx::App > def on_init > dialog = Wx::Dialog.new nil, -1, ''About'' > sizer = Wx::BoxSizer.new Wx::VERTICAL > dialog.set_sizer sizer > html = WrappedHtml.new dialog, -1 > html.set_page <<EOF > <html> > <body> > <a href="http://favicon.ru/en/">My wife web project</a><br /> > <a href="mailto:dmiceman@mail.ru">mail me</a><br /> > </body> > </html> > EOF > sizer.add html, 1, Wx::EXPAND > dialog.set_size Wx::Size.new(400, 300) > dialog.center_on_screen Wx::BOTH > dialog.show true > dialog.evt_close do exit_main_loop end > end > end > app = App.new > app.main_loop > ====================================================> > > > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
Hello, Nick. You wrote 07.05.2005, 12:55:20: N> Thanks for the contributions. Thank you! :-) N> I''ll try to get them in this weekend, N> though the 10 hour workdays have been prohibitive. Yes, i`m understand you very well.. N> I''m glad for all the contributions, but I''d appricate if you focused on N> the SWIG code. You don''t SWIG/Rake/etc to build it - you can use the N> extconf.rb in the src directory. Well.. I have all required components, working wxwidgets 2.6, latest swig, latest ruby and rake. Problem is what i just can`t build swig version of ruby with wxwidgets 2.6. There are a lot of troubles i found. Some of troubles are strange swig behavior, some are related to interface changes between 2.4 and 2.6.. For a moment, i have no working version of wxruby-swig. By the way, how ''wxclasses-2.4.2.xml'' was produced? I think what more recent file can resolve many problems automatically. Also, i see what faults in a file ''wxclasses-2.4.2.xml'' are fixed in ''extractxml.rb''. But is this a good practice? I think what this makes swig version a much more difficult to maintain. -- Dmitry mailto:dmiceman@ubiz.ru
Kevin Smith
2005-May-07 09:12 UTC
[Wxruby-users] wxclasses-2.4.2.xml (was: Wx::HtmlWindow.on_link_clicked)
Dmitry Morozhnikov wrote:> By the way, how ''wxclasses-2.4.2.xml'' was produced? I think what more > recent file can resolve many problems automatically.I described the process here: http://rubyforge.org/pipermail/wxruby-users/2005-February/001173.html It''s hard to tell for sure, but I don''t think he has updated this page, or the xml file, for at least several months.> Also, i see what faults in a file ''wxclasses-2.4.2.xml'' are fixed in > ''extractxml.rb''. But is this a good practice? I think what this makes > swig version a much more difficult to maintain.In a perfect world, the wx folks would publish a full, error-free API spec. That doesn''t appear to be a priority for them, so whatever we do won''t be perfect. We would have exactly the same problem if we weren''t using SWIG. Either way, we must create and maintain a full set of header files (or .t files as we had in wxruby 0.6) describing the API. Using the xml file allowed me to quickly create a "pretty good" set of wx header files. It appears that this process is no longer useful, and we should "fork" all the header files and start maintaining them ourselves. We could get rid of the xml file and the extractxml.rb tool, and from now on just directly update the headers. I''m not sure if we should have separate headers for 2.4 and 2.6, or if we should use #if''s. I think I would prefer separating them. Kevin
I know this is a month late (I hope to address the reason for this soon), but the patch file you sent wants to patch the RCS files as opposed to the .t files. Is this what you meant to do? Dmitry Morozhnikov wrote:> Hello, wxruby-users. > > This is an addition which implement wrapper for > overloading wxHtmlWindow::OnLinkClicked method. Unfortunately, it was > impossible to make it correctly without ugly hack to wxpp.rb, but i`m > hope it does not broke it. > > Please look at attachment for a patch for htmlwindow.t and wxpp.rb and > additional file htmllinkinfo.t (need to be added to $objs array in > extconf.rb). > > Sample code of fancy about dialog for windows (for windows -- because > of using function from shell32.dll to call favorite email client and > favorite browser): > > ====================================================> require ''Win32API'' > require ''wxruby'' > class WrappedHtml < Wx::HtmlWindow > def initialize(*args) > super > @shell = Win32API.new(''shell32'', ''ShellExecute'', ''LPPPPI'', ''L'') > end > def on_link_clicked(link) > @shell.call 0, ''open'', link.get_href, nil, nil, 1 > end > end > class App < Wx::App > def on_init > dialog = Wx::Dialog.new nil, -1, ''About'' > sizer = Wx::BoxSizer.new Wx::VERTICAL > dialog.set_sizer sizer > html = WrappedHtml.new dialog, -1 > html.set_page <<EOF > <html> > <body> > <a href="http://favicon.ru/en/">My wife web project</a><br /> > <a href="mailto:dmiceman@mail.ru">mail me</a><br /> > </body> > </html> > EOF > sizer.add html, 1, Wx::EXPAND > dialog.set_size Wx::Size.new(400, 300) > dialog.center_on_screen Wx::BOTH > dialog.show true > dialog.evt_close do exit_main_loop end > end > end > app = App.new > app.main_loop > ====================================================> > > > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users