Hi! Is drag''n''drop works currently under wxruby? I want an app, where you can drag files from a wxlistctrl to a wxtreectrl. Can anyone show a little example? Gergo -- +-[ Kontra, Gergely<kgergely@mcl.hu> PhD student Room IB113 ]---------+ | http://www.mcl.hu/~kgergely "Olyan langesz vagyok, hogy | | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" | +-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+
KONTRA Gergely wrote:> Is drag''n''drop works currently under wxruby? > I want an app, where you can drag files from a wxlistctrl to a > wxtreectrl.It seems that wxRuby does not yet include the drag and drop classes, such as wxDataObject, wxDropSource, wxDragResult, and wxDropTarget. Unfortunately, adding new classes is pretty low priority for me right now, so I probably won''t add them for at least a couple months. Of course, someone else is welcome to do it. Sorry! Kevin
Kevin Smith wrote:> It seems that wxRuby does not yet include the drag and drop classes, > such as wxDataObject, wxDropSource, wxDragResult, and wxDropTarget.I have added two "feature requests" to the rubyforge project--one for the classes themselves, and another for the sample app. I am going to try using the rubyforge tracker tools to capture requests that are emailed to this list. Kevin
On 1108, Kevin Smith wrote:> Unfortunately, adding new classes is pretty low priority for me right > now, so I probably won''t add them for at least a couple months. Of > course, someone else is welcome to do it.Well, I can try it, but here is my problem: After just installing mingw and msys, and wxwindows, but not with the wxruby install guide, but the official user''s guide "MinGW compilation using makefiles". The main difference: it doesn''t need make install, but it relys on WXWIN environment variable. Here is the wxruby''s build attempt: Kontra Gergely@LIGHTSPEED /d/tmp/wxruby/src $ make g++ -c -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -I/d/programs/wxWin//lib/mswd -I/d/programs/wxWin//include -I/d/programs/wxWin//contrib/include -I/d/programs/wxWin//src/regex -I/d/programs/wxWin//src/png -I/d/programs/wxWin//src/jpeg -I/d/programs/wxWin//src/zlib -I/d/programs/wxWin//src/tiff -I. -Id:/programs/ruby-mingw/lib/ruby/1.8/i386-mingw32 -Id:/programs/ruby-mingw/lib/ruby/1.8/i386-mingw32 -I/d/programs/wxWin//include -I. -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__ -g -D__WXDEBUG__ -Wall -fno-rtti -fno-exceptions -DWIN32_LEAN_AND_MEAN -o wx.o wx.cpp In file included from d:/programs/wxWin/include/wx/defs.h:23, from d:/programs/wxWin/include/wx/wxprec.h:13, from wx.cpp:13: d:/programs/wxWin/include/wx/platform.h:85:22: wx/setup.h: No such file or directory In file included from d:/programs/wxWin/include/wx/platform.h:88, from d:/programs/wxWin/include/wx/defs.h:23, from d:/programs/wxWin/include/wx/wxprec.h:13, from wx.cpp:13: As you can see, the minimal example compiles (c++ version, of course) Kontra Gergely@LIGHTSPEED /d/programs/wxWin/samples/minimal $ make -f makefile.g95 FINAL=1 WXUSINGDLL=1 g++ -c -DWINVER=0x0400 -D__WIN95__ -D__GNUWIN32__ -I../../lib/mswdll -I../../include -I../../contrib/include -I../../src/regex -I../../src/png -I../../src/jpeg -I../../src/zlib -I../../src/tiff -DSTRICT -DHAVE_W32API_H -D__WXMSW__ -D__WINDOWS__ -Wall -O2 -fno-rtti -fno-exceptions -DWXUSINGDLL=1 -o minimal.o minimal.cpp windres --use-temp-file -i minimal.rc -o minimal_resources.o --include-dir ../../include --define __WIN32__ --define __WIN95__ --define __GNUWIN32__ g++ -Wl,--subsystem,windows -mwindows -L../../lib -L../../contrib/lib -o minimal.exe minimal.o minimal_resources.o ../../lib/libwxmsw242.a -lstdc++ -lgcc -lodbc32 -lwsock32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32 -lglu32 -lole32 -loleaut32 -luuid Gergo -- +-[ Kontra, Gergely<kgergely@mcl.hu> PhD student Room IB113 ]---------+ | http://www.mcl.hu/~kgergely "Olyan langesz vagyok, hogy | | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" | +-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+
KONTRA Gergely (kgergely@mlabdial.hit.bme.hu) wrote:> After just installing mingw and msys, and wxwindows, but not with the > wxruby install guide, but the official user''s guide "MinGW compilation > using makefiles". The main difference: it doesn''t need make install, but > it relys on WXWIN environment variable.Why you don''t use wx-config if using MSYS? Then the wx/setup.h issue is automagically solved. Sincerely, Gour -- Gour gour@mail.inet.hr Registered Linux User #278493
Hi! Attached files to get DnD work. Gergo -- +-[ Kontra, Gergely<kgergely@mcl.hu> PhD student Room IB113 ]---------+ | http://www.mcl.hu/~kgergely "Olyan langesz vagyok, hogy | | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" | +-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+ -------------- next part -------------- # Example by Gergely Kontra require ''wxruby'' class MyFileDropTarget < Wx::FileDropTarget def initialize list super() @list=list end def on_drop_files x,y,files for f in files @list.insert_item @list.get_item_count, f end return true end end class MyListCtrl < Wx::ListCtrl def initialize parent super parent,-1,Wx::DEFAULT_POSITION,Wx::DEFAULT_SIZE,Wx::LC_LIST set_drop_target MyFileDropTarget.new(self) end end class MyFrame < Wx::Frame def initialize title super nil, -1, title MyListCtrl.new self end end class DndFileApp < Wx::App def OnInit frame = MyFrame.new "I accept files - Drop files on me!!!" frame.show end end a = DndFileApp.new a.main_loop() -------------- next part -------------- require ''wxruby'' class MyTextDropTarget < Wx::TextDropTarget def on_drop_text(x,y,text) puts "Ouch, I got #{text.inspect} at position (#{x},#{y})" return 1 end end class MyFrame < Wx::Frame def initialize(title) super(nil, -1, title) set_drop_target(MyTextDropTarget.new()) end end class NothingApp < Wx::App def OnInit frame = MyFrame.new("I accept text") frame.show end end a = NothingApp.new a.main_loop() -------------- next part -------------- A non-text attachment was scrubbed... Name: filedroptarget.t Type: application/x-troff Size: 1445 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20031206/f945bd30/filedroptarget.t -------------- next part -------------- A non-text attachment was scrubbed... Name: textdroptarget.t Type: application/x-troff Size: 1302 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20031206/f945bd30/textdroptarget.t
This code has been checked in. I added the two sample apps to the samples/etc directory. I couldn''t get the file drop sample to work with any apps on my system, but the text drop sample worked fine. I don''t think I have any apps that allow file drags. I did make a couple changes to what Gergely submitted: 1. I updated the samples to define on_init instead of OnInit. All of the samples have now been updated to reflect the current naming convention. 2. The submitted code would raise an exception if the ruby callback (on_drop_file or on_drop_text) returned anything other than the ruby true or false values. I think the ruby way is to treat false and nil as false, and anything else as true. I am open to arguments for why we should be more restrictive in this particular case. But for now I changed it to allow return values other than just true or false. Cheers, Kevin KONTRA Gergely wrote:> Hi! > > Attached files to get DnD work. > > Gergo