The previous TreeCtrl.i was very messy and just plain wrong, for instance it had GetFirstChild as depreciated when in fact only 1 version of it was depreciated not both. I changed GetFirstChild and GetNextChild to return an array of values to match the wxPython and wxPerl usage. I also noticed that wxTreeCtrl is inherited from wxControl on Windows and wxScrolledWindow on everything else so I #if defined the .i and .h file accordingly. I also added a .i and .h file for the class wxTreeItemId. The TreeCtrl files were changed so much that I am just uploading the whole files instead of the diffs. traverse_tree(tree_ctrl,tree_ctrl.get_root_item) do |node_id,cookie| puts "Name: #{tree_ctrl.get_item_text(node_id)}\t\tCookie: #{cookie}" end def traverse_tree(tree_ctrl,root_node,cookie=0,&block) if cookie == 0 ret = tree_ctrl.get_first_child(root_node) else ret = tree_ctrl.get_next_child(root_node,cookie) end if ret[0].is_ok if block_given? yield(ret[0],ret[1]) end traverse_tree(tree_ctrl,ret[0],0,&block) end ret_sib = tree_ctrl.get_next_sibling(root_node) if ret_sib.is_ok if block_given? yield(ret_sib,cookie) end traverse_tree(tree_ctrl,ret_sib,0,&block) end end Sean _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
Has anyone had a chance to look at these changes I made? I think it would be nice to get it in before an alpha release. Sean On 8/18/06, Sean Long <sean.m.long at gmail.com> wrote:> The previous TreeCtrl.i was very messy and just plain wrong, for > instance it had GetFirstChild as depreciated when in fact only 1 > version of it was depreciated not both. > > I changed GetFirstChild and GetNextChild to return an array of values > to match the wxPython and wxPerl usage. > > I also noticed that wxTreeCtrl is inherited from wxControl on Windows > and wxScrolledWindow on everything else so I #if defined the .i and .h > file accordingly. > > I also added a .i and .h file for the class wxTreeItemId. > > The TreeCtrl files were changed so much that I am just uploading the > whole files instead of the diffs. > > traverse_tree(tree_ctrl,tree_ctrl.get_root_item) do |node_id,cookie| > puts "Name: #{tree_ctrl.get_item_text(node_id)}\t\tCookie: > #{cookie}" > end > > def traverse_tree(tree_ctrl,root_node,cookie=0,&block) > if cookie == 0 > ret = tree_ctrl.get_first_child(root_node) > else > ret = tree_ctrl.get_next_child(root_node,cookie) > end > > if ret[0].is_ok > if block_given? > yield(ret[0],ret[1]) > end > > traverse_tree(tree_ctrl,ret[0],0,&block) > end > > ret_sib = tree_ctrl.get_next_sibling(root_node) > if ret_sib.is_ok > if block_given? > yield(ret_sib,cookie) > end > traverse_tree(tree_ctrl,ret_sib,0,&block) > end > > end > > > Sean > > >
They are in. Thanks, Kevin On Sun, 2006-08-20 at 19:26 -0700, Sean Long wrote:> Has anyone had a chance to look at these changes I made? I think it > would be nice to get it in before an alpha release. > > Sean > > On 8/18/06, Sean Long <sean.m.long at gmail.com> wrote: > > The previous TreeCtrl.i was very messy and just plain wrong, for > > instance it had GetFirstChild as depreciated when in fact only 1 > > version of it was depreciated not both. > > > > I changed GetFirstChild and GetNextChild to return an array of values > > to match the wxPython and wxPerl usage. > > > > I also noticed that wxTreeCtrl is inherited from wxControl on Windows > > and wxScrolledWindow on everything else so I #if defined the .i and .h > > file accordingly. > > > > I also added a .i and .h file for the class wxTreeItemId. > > > > The TreeCtrl files were changed so much that I am just uploading the > > whole files instead of the diffs. > > > > traverse_tree(tree_ctrl,tree_ctrl.get_root_item) do |node_id,cookie| > > puts "Name: #{tree_ctrl.get_item_text(node_id)}\t\tCookie: > > #{cookie}" > > end > > > > def traverse_tree(tree_ctrl,root_node,cookie=0,&block) > > if cookie == 0 > > ret = tree_ctrl.get_first_child(root_node) > > else > > ret = tree_ctrl.get_next_child(root_node,cookie) > > end > > > > if ret[0].is_ok > > if block_given? > > yield(ret[0],ret[1]) > > end > > > > traverse_tree(tree_ctrl,ret[0],0,&block) > > end > > > > ret_sib = tree_ctrl.get_next_sibling(root_node) > > if ret_sib.is_ok > > if block_given? > > yield(ret_sib,cookie) > > end > > traverse_tree(tree_ctrl,ret_sib,0,&block) > > end > > > > end > > > > > > Sean > > > > > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
On Sun, 2006-08-20 at 19:26 -0700, Sean Long wrote:>> Has anyone had a chance to look at these changes I made? I think it >> would be nice to get it in before an alpha release. >> >> Sean >>Unfortunately, these don''t work with MSWindows. Many of the functions are only available for the generic version. I''ll see what I can do to whip up a patch file. Roy
On Sun, 2006-08-20 at 23:31 -0400, Roy Sutton wrote:> On Sun, 2006-08-20 at 19:26 -0700, Sean Long wrote: > >> Has anyone had a chance to look at these changes I made? I think it > >> would be nice to get it in before an alpha release. > >> > >> Sean > >> > Unfortunately, these don''t work with MSWindows. Many of the functions > are only available for the generic version. I''ll see what I can do to > whip up a patch file.Doh! I sure wish there was an easy and automatic way to filter those out. Maybe I can set up a cross-compiler on my system so I can at least attempt an MS Windows build which would detect that. Hm. Has anyone else tried that? We can revert the change if necessary. Hopefully it won''t be. Thanks, Kevin
Here is a patch to make it work on windows. Sean On 8/20/06, Kevin Smith <wxruby at qualitycode.com> wrote:> On Sun, 2006-08-20 at 23:31 -0400, Roy Sutton wrote: > > On Sun, 2006-08-20 at 19:26 -0700, Sean Long wrote: > > >> Has anyone had a chance to look at these changes I made? I think it > > >> would be nice to get it in before an alpha release. > > >> > > >> Sean > > >> > > Unfortunately, these don''t work with MSWindows. Many of the functions > > are only available for the generic version. I''ll see what I can do to > > whip up a patch file. > > Doh! I sure wish there was an easy and automatic way to filter those > out. Maybe I can set up a cross-compiler on my system so I can at least > attempt an MS Windows build which would detect that. Hm. Has anyone else > tried that? > > We can revert the change if necessary. Hopefully it won''t be. > > Thanks, > > Kevin > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-------------- next part -------------- A non-text attachment was scrubbed... Name: wxTreeCtrl_h.patch Type: application/octet-stream Size: 4689 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20060820/7d9e338b/attachment.obj
Roy can you confirm that the patch I posted yesterday works and hopefully Kevin or Alex can commit it. I am going to have less and less time to devote to wxRuby and want to make sure I have the loose ends I am involved with tied up. Thanks Sean On 8/20/06, Sean Long <sean.m.long at gmail.com> wrote:> Here is a patch to make it work on windows. > > Sean
Sean Long wrote:> Roy can you confirm that the patch I posted yesterday works and > hopefully Kevin or Alex can commit it. I am going to have less and > less time to devote to wxRuby and want to make sure I have the loose > ends I am involved with tied up.I''m not Roy, but I can confirm that it compiles. The BigDemo wxTreeCtrl fails though. The error message is: A problem occurred with the wxTreeCtrl demo: undefined method `get_icon'' for Wxruby2::ArtProvider:Class ./wxTreeCtrl.rbw:57:in `initialize'' ./wxTreeCtrl.rbw:160:in `run'' C:/dev/wxruby2/samples/bigdemo/Main.rbw:396:in `run_demo'' C:/dev/wxruby2/samples/bigdemo/Main.rbw:356:in `on_tree_sel_changed'' C:/dev/wxruby2/samples/bigdemo/Main.rbw:287:in `initialize'' C:/dev/wxruby2/samples/bigdemo/Main.rbw:551 --Mark Ping
Mark, Thanks for the info, I mostly just wanted to know if it compiled on Windows (it did for me). I don''t know if I will have time to fix that crashing error but thank you for posting it, it should help someone down the line. Sean On 8/22/06, Mark Ping <wxruby at roadq.com> wrote:> Sean Long wrote: > > Roy can you confirm that the patch I posted yesterday works and > > hopefully Kevin or Alex can commit it. I am going to have less and > > less time to devote to wxRuby and want to make sure I have the loose > > ends I am involved with tied up. > I''m not Roy, but I can confirm that it compiles. The BigDemo wxTreeCtrl > fails though. The error message is: > > > A problem occurred with the wxTreeCtrl demo: > undefined method `get_icon'' for Wxruby2::ArtProvider:Class > ./wxTreeCtrl.rbw:57:in `initialize'' > ./wxTreeCtrl.rbw:160:in `run'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:396:in `run_demo'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:356:in `on_tree_sel_changed'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:287:in `initialize'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:551 > > --Mark Ping > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >
Thank you Mark, Sean It looks to me very much as if the problem with ArtProvider is unrelated to the TreeCtrl changes. I am not sure if get_icon is meant to be a class or instance method, but either way the method is currently %ignored in ArtProvider.i, with a note that the method is not compatible with SWIG 1.3.29. I guess the correct way to fix this for the time being is to comment out the offending lines in wxTreeCtrl.rb in the bigdemo. Sean - I will go ahead and commit your recent Windows-fix patch once I have tried it out here. cheers alex Mark Ping wrote:> Sean Long wrote: > >> Roy can you confirm that the patch I posted yesterday works and >> hopefully Kevin or Alex can commit it. I am going to have less and >> less time to devote to wxRuby and want to make sure I have the loose >> ends I am involved with tied up. >> > I''m not Roy, but I can confirm that it compiles. The BigDemo wxTreeCtrl > fails though. The error message is: > > > A problem occurred with the wxTreeCtrl demo: > undefined method `get_icon'' for Wxruby2::ArtProvider:Class > ./wxTreeCtrl.rbw:57:in `initialize'' > ./wxTreeCtrl.rbw:160:in `run'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:396:in `run_demo'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:356:in `on_tree_sel_changed'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:287:in `initialize'' > C:/dev/wxruby2/samples/bigdemo/Main.rbw:551 > > --Mark Ping > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > >
Sean Long wrote:> Here is a patch to make it work on windows.Committed, thank you. Also, have commented out currently unsupported ArtProvider calls in the bigdemo/wxTreeCtrl.rb, and related calls to set images. This at least allows it to display, though currently crashes when editing tree item labels b/c TreeEvent#get_label is not supported. alex
Maybe Matching Threads
- update on samples
- [779] trunk/wxruby2: Added TreeCtrl#traverse method and documentation
- [741] trunk/wxruby2: Fix get_item_data, hiding TreeItemData messiness, fix GC-ing (Alex Fenton)
- [1046] trunk/wxruby2/swig/classes/TreeCtrl.i: Prevent crashes in TreeCtrl from premature deletion of associated ImageList
- Patch to wxComboBox.rbw