From devel at nicreations.com Sat Jan 1 02:10:11 2005 From: devel at nicreations.com (Nick) Date: Sat Jan 1 02:10:41 2005 Subject: [Wxruby-users] catch keystrokes In-Reply-To: <41D5C41D.7010008@vfxnetwork.com> References: <41D5C41D.7010008@vfxnetwork.com> Message-ID: <41D64CD3.2080507@nicreations.com> Luis G. G?mez wrote: > is it possible to intercept keystrokes using wxruby? Could you be a little more specific? Nick From lgomez at vfxnetwork.com Sat Jan 1 02:23:41 2005 From: lgomez at vfxnetwork.com (=?ISO-8859-1?Q?=22Luis_G=2E_G=F3mez=22?=) Date: Sat Jan 1 02:21:41 2005 Subject: [Wxruby-users] catch keystrokes In-Reply-To: <41D64CD3.2080507@nicreations.com> References: <41D5C41D.7010008@vfxnetwork.com> <41D64CD3.2080507@nicreations.com> Message-ID: <41D64FFD.2030809@vfxnetwork.com> I have this: ===== require "wxruby" include Wx class MinimalApp < App def on_init Frame.new(nil, -1, "The Bare Minimum",Point.new(0,0),Size.new(0,0),MAXIMIZE).show() end end MinimalApp.new.main_loop ===== What I want to do is block the use of Alt+Tab so users cannot switch applications. Usefull for kiosk-like applications. Thank you, LG Nick wrote: > Luis G. G?mez wrote: > >> is it possible to intercept keystrokes using wxruby? > > > Could you be a little more specific? > > Nick > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From devel at nicreations.com Sat Jan 1 02:34:21 2005 From: devel at nicreations.com (Nick) Date: Sat Jan 1 02:34:50 2005 Subject: [Wxruby-users] catch keystrokes In-Reply-To: <41D64FFD.2030809@vfxnetwork.com> References: <41D5C41D.7010008@vfxnetwork.com> <41D64CD3.2080507@nicreations.com> <41D64FFD.2030809@vfxnetwork.com> Message-ID: <41D6527D.3080804@nicreations.com> Since Alt-Tab is system recognized, wxWidgets can't intercept it. You might have better luck with the Win32 tools. Nick Luis G. G?mez wrote: > I have this: > > ===== > > require "wxruby" > include Wx > class MinimalApp < App > def on_init > Frame.new(nil, -1, "The Bare > Minimum",Point.new(0,0),Size.new(0,0),MAXIMIZE).show() > end > end > MinimalApp.new.main_loop > > ===== > > What I want to do is block the use of Alt+Tab so users cannot switch > applications. Usefull for kiosk-like applications. > > Thank you, > > LG > > Nick wrote: > >> Luis G. G?mez wrote: >> >>> is it possible to intercept keystrokes using wxruby? >> >> >> >> Could you be a little more specific? >> >> Nick >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > From lgomez at vfxnetwork.com Sat Jan 1 02:48:59 2005 From: lgomez at vfxnetwork.com (=?ISO-8859-1?Q?=22Luis_G=2E_G=F3mez=22?=) Date: Sat Jan 1 02:46:57 2005 Subject: [Wxruby-users] catch keystrokes In-Reply-To: <41D64CD3.2080507@nicreations.com> References: <41D5C41D.7010008@vfxnetwork.com> <41D64CD3.2080507@nicreations.com> Message-ID: <41D655EB.9050601@vfxnetwork.com> Ok, sorry. I changed to this but it does nothing: ===== require "wxruby" include Wx class ClientFrame < Frame def initialize() super(nil,-1,"Pathology Software",Point.new(0,0),Size.new(0,0),MAXIMIZE) evt_key_down{|event|nil} show() end end class PathologySoft < App def on_init ClientFrame.new() end end PathologySoft.new.main_loop ===== Nick wrote: > Luis G. G?mez wrote: > >> is it possible to intercept keystrokes using wxruby? > > > Could you be a little more specific? > > Nick > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From lgomez at vfxnetwork.com Sat Jan 1 02:50:14 2005 From: lgomez at vfxnetwork.com (=?ISO-8859-1?Q?=22Luis_G=2E_G=F3mez=22?=) Date: Sat Jan 1 02:48:12 2005 Subject: [Wxruby-users] catch keystrokes In-Reply-To: <41D6527D.3080804@nicreations.com> References: <41D5C41D.7010008@vfxnetwork.com> <41D64CD3.2080507@nicreations.com> <41D64FFD.2030809@vfxnetwork.com> <41D6527D.3080804@nicreations.com> Message-ID: <41D65636.6090201@vfxnetwork.com> Win32 Tools? Nick wrote: > > Since Alt-Tab is system recognized, wxWidgets can't intercept it. You > might have better luck with the Win32 tools. > > Nick > > Luis G. G?mez wrote: > >> I have this: >> >> ===== >> >> require "wxruby" >> include Wx >> class MinimalApp < App >> def on_init >> Frame.new(nil, -1, "The Bare >> Minimum",Point.new(0,0),Size.new(0,0),MAXIMIZE).show() >> end >> end >> MinimalApp.new.main_loop >> >> ===== >> >> What I want to do is block the use of Alt+Tab so users cannot switch >> applications. Usefull for kiosk-like applications. >> >> Thank you, >> >> LG >> >> Nick wrote: >> >>> Luis G. G?mez wrote: >>> >>>> is it possible to intercept keystrokes using wxruby? >>> >>> >>> >>> >>> Could you be a little more specific? >>> >>> Nick >>> _______________________________________________ >>> wxruby-users mailing list >>> wxruby-users@rubyforge.org >>> http://rubyforge.org/mailman/listinfo/wxruby-users >> >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> >> >> > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From alex at pressure.to Wed Jan 5 15:34:45 2005 From: alex at pressure.to (alex fenton) Date: Wed Jan 5 15:33:39 2005 Subject: [Wxruby-users] Unit testing Wx GUIs Message-ID: <41DC4F65.5040307@pressure.to> Hi folks Happy new year to everyone. Has anyone got any ideas forunit-testing WxRuby apps. I'm thinking of things like "Simulate click this menu item; choose file "/path/to/file" in Dialog; click OK; assert - something added to this ComboBox..;" Just spotted a little regression bug in my new Weft release :( cheers alex From wxruby at qualitycode.com Thu Jan 6 10:05:22 2005 From: wxruby at qualitycode.com (Kevin Smith) Date: Thu Jan 6 10:03:24 2005 Subject: [Wxruby-users] Unit testing Wx GUIs In-Reply-To: <41DC4F65.5040307@pressure.to> References: <41DC4F65.5040307@pressure.to> Message-ID: <41DD53B2.8080807@qualitycode.com> alex fenton wrote: > Happy new year to everyone. Has anyone got any ideas forunit-testing > WxRuby apps. I'm thinking of things like "Simulate click this menu item; > choose file "/path/to/file" in Dialog; click OK; assert - something > added to this ComboBox..;" I spent a day or two last summer trying to create "headless" unit tests for wxRuby code (where nothing would be displayed on the screen). I was unable to get that working, so I think any tests will actually have to create the app and main window, and display them. You might be able to bring them up off-screen for better speed and less eyestrain. Beyond that, I think you should be able to do most of what you want simply by calling into the API. Have you already tried it and run into problems? Or are you thinking of heading toward a higher-level meta scripting language that could drive wxRuby widgets generically? When unit testing a gui, most folks trust that a click on a button will, in fact, activate the button (as long as it is not disabled, etc.) Generally the desire it to execute the button click handler and then make sure it did what it was supposed to do. Feel free to ask more specific questions, or toss some code up here for comments. Cheers, Kevin From jani at iv.ro Mon Jan 10 07:28:44 2005 From: jani at iv.ro (Jani Monoses) Date: Mon Jan 10 07:38:46 2005 Subject: [Wxruby-users] darcs repo? Message-ID: Hello all Are the darcs repos of wxRuby no longer updated? thanks Jani From wxruby at qualitycode.com Mon Jan 10 07:56:01 2005 From: wxruby at qualitycode.com (Kevin Smith) Date: Mon Jan 10 07:53:55 2005 Subject: [Wxruby-users] darcs repo? In-Reply-To: References: Message-ID: <41E27B61.7090102@qualitycode.com> Jani Monoses wrote: > Hello all > > Are the darcs repos of wxRuby no longer updated? They are no longer updated, so what's up there is very stale. I will remove them to avoid confusion (although I'm not sure when I'll get around to it. Sorry and thanks, Kevin From devel at nicreations.com Sun Jan 16 03:50:18 2005 From: devel at nicreations.com (Nick) Date: Sun Jan 16 03:50:24 2005 Subject: [Wxruby-users] wxWidgets 2.5 Message-ID: <41EA2ACA.6010500@nicreations.com> I've just gotten wxruby-swig to compile with wxWidgets 2.5 on Mac OS X. Thankfully, it mostly consists of getting rid of already depricated methods from the widget classes. I need to try with Linux and Win32, but it should be a smooth transition. Nick From zdennis at mktec.com Sun Jan 16 18:38:25 2005 From: zdennis at mktec.com (Zach Dennis) Date: Sun Jan 16 18:39:54 2005 Subject: [Wxruby-users] New Doc Status Message-ID: <41EAFAF1.8040907@mktec.com> I know it's been a few weeks since Nick asked me to work on new wxRuby document output from the xml file in the wxruby-swig source tree. So I'm updating the list so you know that it is underway. A new wxRuby API is coming!! I have the parsing complete, and I am trying to make this be most-beneficial to the wxRuby community. Perhaps someone reading this may have an opinion, idea or insight that will help. Here's the direction I have/am moving in... - Extract the classes from the xml file into individual class text files in a generic format - Read in cpp files for all rb_define* statements and create a map of ruby methods to c++ methods. This will be intelligent, because methods are named with the convention "_wrap_className_methodName". (If this convention isn't universal Nick, could you give me a heads up) - Generate Html files. While generating files, filtering the c++ methods, and putting in ruby method/class names. (There will be references to the c++ class/method names, and I am planning on linking to the online wxWindows documentation for easy reference if needed) - Generate index files for frame-based navigation As of now I am planning on the navigation to be similar to the output of the Java API (or any javadoc output for that matter) Some areas I'm looking for more input: - Possibly writing dummy ruby source files and inserting the wxruby documentation from the api where necessary to generate proper rdoc output. Then writing a rdoc generator to alter the appearance to be more or a javadoc like output. - Writing my own html files and output format in order to get the docs out quicker, still javadoc-like output Any input is greatly appreciated. Thanks! Zach From devel at nicreations.com Sun Jan 16 19:08:24 2005 From: devel at nicreations.com (Nick) Date: Sun Jan 16 19:08:27 2005 Subject: [Wxruby-users] New Doc Status In-Reply-To: <41EAFAF1.8040907@mktec.com> References: <41EAFAF1.8040907@mktec.com> Message-ID: <41EB01F8.2050600@nicreations.com> > I know it's been a few weeks since Nick asked me to work on new wxRuby > document output from the xml file in the wxruby-swig source tree. So I'm > updating the list so you know that it is underway. A new wxRuby API is > coming!! Thats great news Zach. > - Read in cpp files for all rb_define* statements and create a map of > ruby methods to c++ methods. This will be intelligent, because methods > are named with the convention "_wrap_className_methodName". (If this > convention isn't universal Nick, could you give me a heads up) > That's swig's convention as far as I know. I'm glad you're doing that step, as there are a number of methods that don't translate well. > - Possibly writing dummy ruby source files and inserting the wxruby > documentation from the api where necessary to generate proper rdoc > output. Then writing a rdoc generator to alter the appearance to be more > or a javadoc like output. I always thought that was a good approach, despite my hatred of rubydoc. It sounds like you've made a lot of progress. Good work. Nick Zach Dennis wrote: > I know it's been a few weeks since Nick asked me to work on new wxRuby > document output from the xml file in the wxruby-swig source tree. So I'm > updating the list so you know that it is underway. A new wxRuby API is > coming!! > > I have the parsing complete, and I am trying to make this be > most-beneficial to the wxRuby community. Perhaps someone reading this > may have an opinion, idea or insight that will help. Here's the > direction I have/am moving in... > > - Extract the classes from the xml file into individual class text files > in a generic format > > - Read in cpp files for all rb_define* statements and create a map of > ruby methods to c++ methods. This will be intelligent, because methods > are named with the convention "_wrap_className_methodName". (If this > convention isn't universal Nick, could you give me a heads up) > > - Generate Html files. While generating files, filtering the c++ > methods, and putting in ruby method/class names. (There will be > references to the c++ class/method names, and I am planning on linking > to the online wxWindows documentation for easy reference if needed) > > - Generate index files for frame-based navigation > > As of now I am planning on the navigation to be similar to the output of > the Java API (or any javadoc output for that matter) > > Some areas I'm looking for more input: > > - Possibly writing dummy ruby source files and inserting the wxruby > documentation from the api where necessary to generate proper rdoc > output. Then writing a rdoc generator to alter the appearance to be more > or a javadoc like output. > > - Writing my own html files and output format in order to get the docs > out quicker, still javadoc-like output > > Any input is greatly appreciated. Thanks! > > Zach > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > From wxruby at qualitycode.com Mon Jan 17 10:12:01 2005 From: wxruby at qualitycode.com (Kevin Smith) Date: Mon Jan 17 10:09:42 2005 Subject: [Wxruby-users] wxWidgets 2.5 In-Reply-To: <41EA2ACA.6010500@nicreations.com> References: <41EA2ACA.6010500@nicreations.com> Message-ID: <41EBD5C1.3070507@qualitycode.com> Nick wrote: > > I've just gotten wxruby-swig to compile with wxWidgets 2.5 on Mac OS X. > Thankfully, it mostly consists of getting rid of already depricated > methods from the widget classes. I need to try with Linux and Win32, but > it should be a smooth transition. That's exciting news! Thanks again for your work. Kevin From alex at pressure.to Tue Jan 18 13:51:07 2005 From: alex at pressure.to (alex fenton) Date: Tue Jan 18 13:48:49 2005 Subject: [Wxruby-users] wxWidgets 2.5 In-Reply-To: <41EA2ACA.6010500@nicreations.com> References: <41EA2ACA.6010500@nicreations.com> Message-ID: <41ED5A9B.1080308@pressure.to> > I've just gotten wxruby-swig to compile with wxWidgets 2.5 on Mac OS X. Great news, thank you for your efforts. Out of interest, does this produce Aqua-style or X11-style GUIs on OSX? From devel at nicreations.com Tue Jan 18 18:42:07 2005 From: devel at nicreations.com (Nick) Date: Tue Jan 18 18:42:06 2005 Subject: [Wxruby-users] wxWidgets 2.5 In-Reply-To: <41ED5A9B.1080308@pressure.to> References: <41EA2ACA.6010500@nicreations.com> <41ED5A9B.1080308@pressure.to> Message-ID: <41ED9ECF.5020707@nicreations.com> > Great news, thank you for your efforts. Out of interest, does this > produce Aqua-style or X11-style GUIs on OSX? wx has always had Aqua-widgets on OS X. For Aqua widgets in Ruby, I think RubyCocoa and wxRuby are the only two that do it. Nick alex fenton wrote: >> I've just gotten wxruby-swig to compile with wxWidgets 2.5 on Mac OS X. > > > Great news, thank you for your efforts. Out of interest, does this > produce Aqua-style or X11-style GUIs on OSX? > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > From melfstrand at maf.org Wed Jan 19 12:49:52 2005 From: melfstrand at maf.org (Marshall Elfstrand) Date: Wed Jan 19 12:47:22 2005 Subject: [Wxruby-users] wxWidgets 2.5 In-Reply-To: <41ED9ECF.5020707@nicreations.com> References: <41EA2ACA.6010500@nicreations.com> <41ED5A9B.1080308@pressure.to> <41ED9ECF.5020707@nicreations.com> Message-ID: <859838B6-6A42-11D9-95B2-000A95A04A54@maf.org> I believe Tk and Qt also use some native widgets now in their Aqua incarnations, but I haven't been impressed with either. Text rendering in particular looks like a bad Carbon port. Plus, I don't think either one fully adopts XP themes on Windows, and Qt isn't free on Windows. WxWidgets is free on all platforms, and it's the only cross-platform GUI toolkit I've seen that gets tabbed panels right. Even Swing, which has had a lot of work put into both the Windows and OS X look-and-feel, doesn't render tabbed panels correctly. Nick, thank you so much for working on getting 2.5 running. That's fantastic news! I'd be happy to test on OS X as it progresses. Marshall On Jan 18, 2005, at 3:42 PM, Nick wrote: > > > Great news, thank you for your efforts. Out of interest, does this > > produce Aqua-style or X11-style GUIs on OSX? > > wx has always had Aqua-widgets on OS X. For Aqua widgets in Ruby, I > think RubyCocoa and wxRuby are the only two that do it. > > Nick > > alex fenton wrote: >>> I've just gotten wxruby-swig to compile with wxWidgets 2.5 on Mac OS >>> X. >> Great news, thank you for your efforts. Out of interest, does this >> produce Aqua-style or X11-style GUIs on OSX? >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From mdufort_ml at sympatico.ca Thu Jan 20 06:45:27 2005 From: mdufort_ml at sympatico.ca (Martin Dufort) Date: Thu Jan 20 06:42:54 2005 Subject: [Wxruby-users] Compiling wxRuby 0.6 with Borland C++ Compiler Message-ID: I'm trying to recompile wxRuby 0.6 using Borland's C++ Compiler (version 5.5.1). So far I was able to do the following: 1) Recompile a working version of ruby V1.8.1 executable using bcc32 2) Recompile a working version of wxWindows 2.4.2 using bcc32 ? However for wxruby, I'm having some problems with the Makefile which I fixed. Now when I'm compiling the wxRuby wrapper classes like htmlprocessor.cpp i'm getting the following error: E2167: c:\tools\bcc\include\process.h 180: 'abort()' was previously declared with the language 'C' ... and so on for all the system calls. My interpretation of this is that there is an extern 'C' somewhere surrounding those includes. However I do not understand why this is spit out at compile-time and not at link time... I'm sure this is a dumb error but I'm unable to figure out how to clear that up. Anybody here was able to do the same thing? Thanks for your help... -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 978 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20050120/5eac841c/attachment-0001.bin From devel at nicreations.com Thu Jan 20 07:09:14 2005 From: devel at nicreations.com (Nick) Date: Thu Jan 20 07:09:10 2005 Subject: [Wxruby-users] Compiling wxRuby 0.6 with Borland C++ Compiler In-Reply-To: References: Message-ID: <41EF9F6A.2020807@nicreations.com> Can you spit out the full error log of compiling one of the files? Thanks, Nick Martin Dufort wrote: > > I'm trying to recompile wxRuby 0.6 using Borland's C++ Compiler (version > 5.5.1). > So far I was able to do the following: > 1) Recompile a working version of ruby V1.8.1 executable using bcc32 > 2) Recompile a working version of wxWindows 2.4.2 using bcc32 > > However for wxruby, I'm having some problems with the Makefile which I > fixed. > Now when I'm compiling the wxRuby wrapper classes like htmlprocessor.cpp > i'm getting the following > error: > E2167: c:\tools\bcc\include\process.h 180: 'abort()' was previously > declared with the language 'C' > ... > and so on for all the system calls. > My interpretation of this is that there is an extern 'C' somewhere > surrounding those includes. However I do not understand > why this is spit out at compile-time and not at link time... > > I'm sure this is a dumb error but I'm unable to figure out how to clear > that up. Anybody here was able to do the same thing? > Thanks for your help... > > > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From mdufort_ml at sympatico.ca Thu Jan 20 19:39:15 2005 From: mdufort_ml at sympatico.ca (Martin Dufort) Date: Thu Jan 20 19:36:41 2005 Subject: [Wxruby-users] Compiling wxRuby 0.6 with Borland C++ Compiler In-Reply-To: <41EF9F6A.2020807@nicreations.com> References: <41EF9F6A.2020807@nicreations.com> Message-ID: Sure here it is: [c:\tools\dev\wxruby-0.6-src\src]make -fMakefile htmlprocessor.obj MAKE Version 5.2 Copyright (c) 1987, 2000 Borland bcc32 -q -O -6 -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi -IC:\tools\dev\wxWindows-2.4.2/ include -IC:\tools\dev\wxWindows-2.4.2/contrib/include -IC:\tools\dev\wxWindows-2.4.2/lib/msw -DSTRI CT -DWIN32 -D__WIN32__ -D_WINDOWS -DWINVER=0x0400 /D__WIN95__ /D__WXMSW__ /D__WINDOWS__ -D__WXMSW__ -DNDEBUG -I. -IC:/tools/dev/ruby-bcc-182/lib/ruby/1.8/i386-bccwin32 -IC:/tools/dev/ruby-bcc-182/lib/ ruby/1.8/i386-bccwin32 -I. -I. -I../ -I../missing -P -c .\htmlprocessor.cpp .\htmlprocessor.cpp: Error E2167 c:\tools\dev\bcc55\include\process.h 180: 'abort()' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\process.h 191: 'exit(int)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\process.h 192: '_exit(int)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\process.h 201: 'system(const char *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\process.h 218: '_wsystem(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 299: 'atof(const char *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 324: 'abs(int)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 327: 'labs(long)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 329: '_atold(const char *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 337: '_atoi64(const char *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 338: '_i64toa(__int64,char *,int)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 339: '_ui64toa(unsigned __int64,char *,int)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 340: '_wtoi64(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 341: '_i64tow(__int64,wchar_t *,int)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 342: '_ui64tow(unsigned __int64,wchar_t *,int)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 343: '_wtof(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 344: '_wtoi(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 345: '_wtol(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\math.h 346: '_wtold(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\io.h 276: '_rtl_chmod(const char *,int,...)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\io.h 277: '_chmod(const char *,int,...)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\io.h 298: '_wunlink(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\io.h 299: '_wremove(const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\io.h 300: '_wrename(const wchar_t *,const wchar_t *)' was previously declared with the language 'C' Error E2167 c:\tools\dev\bcc55\include\io.h 302: '_wmktemp(wchar_t *)' was previously declared with the language 'C' Error E2228 c:\tools\dev\bcc55\include\io.h 302: Too many error or warning messages *** 26 errors in Compile *** ** error 1 ** deleting htmlprocessor.obj On 20-Jan-05, at 7:09, Nick wrote: > > Can you spit out the full error log of compiling one of the files? > > Thanks, > > Nick > > Martin Dufort wrote: >> I'm trying to recompile wxRuby 0.6 using Borland's C++ Compiler >> (version 5.5.1). >> So far I was able to do the following: >> 1) Recompile a working version of ruby V1.8.1 executable using bcc32 >> 2) Recompile a working version of wxWindows 2.4.2 using bcc32 >> However for wxruby, I'm having some problems with the Makefile which >> I fixed. >> Now when I'm compiling the wxRuby wrapper classes like >> htmlprocessor.cpp i'm getting the following >> error: >> E2167: c:\tools\bcc\include\process.h 180: 'abort()' was previously >> declared with the language 'C' >> ... >> and so on for all the system calls. >> My interpretation of this is that there is an extern 'C' somewhere >> surrounding those includes. However I do not understand >> why this is spit out at compile-time and not at link time... >> I'm sure this is a dumb error but I'm unable to figure out how to >> clear that up. Anybody here was able to do the same thing? >> Thanks for your help... >> ---------------------------------------------------------------------- >> -- >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From sdate at everestkc.net Sat Jan 22 00:48:39 2005 From: sdate at everestkc.net (Shashank Date) Date: Sat Jan 22 00:46:07 2005 Subject: [Wxruby-users] Dragging images across the canvas Message-ID: <41F1E937.9060003@everestkc.net> Hi wxRuby Gurus, I'm trying to write a sample program which allows me to drag an image (by left_mouse_button down) across the canvas. I got it to work ... well, sort of. The problem is I can drag it only by clicking on the left top corner of the image and nowhere else. Besides, the dragging is not very smooth. How can I make it better? I am using wxRuby 0.6.0 on Win XP (Home) and Ruby installed using the latest one-click Ruby installer. Code follows, image file (sk.png) attached. TIA, -- shanko ################# require 'wxruby' class MyFrame < Wx::Frame def initialize(title) super(nil, -1, title,Wx::DEFAULT_POSITION, Wx::Size.new(250,250)) image = Wx::Image.new("sk.png") @bitmap = Wx::Bitmap.new(image) @left_dn = false evt_paint { on_paint } evt_motion {|event| on_motion(event) } evt_left_down {|event| @left_dn = true } evt_left_up {|event| @left_dn = false } end def move_region(nx,ny) ox,oy,w,h = @reg.get_box @reg.clear @reg = Wx::Region.new(nx,ny,nx+w,ny+h) dc = Wx::ClientDC.new(self) # Erase from the existing location # wb = Wx::WHITE_BRUSH dc.set_brush(wb) dc.set_pen(Wx::WHITE_PEN) dc.draw_rectangle(ox,oy,ox+w,oy+h) # Draw at the new location # dc.draw_bitmap(@bitmap,nx,ny,false) dc.free end def on_motion(event) x = event.get_x y = event.get_y move_region(x,y) if (@left_dn and (@reg.contains(x,y) == 0)) end def on_paint paint{|dc| dc.clear dc.draw_bitmap(@bitmap, 0, 0, false) } w,h = @bitmap.get_width, @bitmap.get_height @reg = Wx::Region.new(0,0,w,h) end end class ImagesApp < Wx::App def on_init frame = MyFrame.new("Simple Image Demo") frame.show end end Wx::init_all_image_handlers a = ImagesApp.new a.main_loop() __END__ -------------- next part -------------- A non-text attachment was scrubbed... Name: sk.png Type: image/png Size: 961 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20050121/40d722ad/sk.png From wxruby at qualitycode.com Sat Jan 22 22:05:52 2005 From: wxruby at qualitycode.com (Kevin Smith) Date: Sat Jan 22 22:03:21 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F1E937.9060003@everestkc.net> References: <41F1E937.9060003@everestkc.net> Message-ID: <41F31490.1090802@qualitycode.com> Shashank Date wrote: > I'm trying to write a sample program which allows me to drag an image > (by left_mouse_button down) across the canvas. I'm not in a position where I can even run your code right now, but I can try to provide a few clues. > I got it to work ... well, sort of. The problem is I can drag it only by > clicking on the left top corner of the image and nowhere else. The test in on_motion looks odd. It seems that if the endpoint of the drag event is still within the border of the image, the drag is ignored. That means only drag events that start within the image but end outside will actually cause dragging. You might want to set @left_dn true ONLY if the down event started within the image. Then in on_motion if left_dn is true, do a move. At that point you might rename the variable to @dragging. Many programs that do this also capture the mouse. My mind is too fuzzy right now to remember if that is necessary for your purposes. > Besides, the dragging is not very smooth. How can I make it better? Drawing directly to the screen is always very slow. You will almost certainly want to use "double buffering", known in some graphics toolkits as a "canvas". That's where you write to an off-screen bitmap, and then just "blit" (transfer) the bitmap to the screen. I don't think wx has a built-in canvas object, and I don't remember any wxRuby examples using this, so you may have to do it yourself. I think you can find an example in the Space Monkeys game I wrote a while back. The code hasn't been updated, so it probably won't work with a current version of wxRuby. But you can at least see the idea. The tarball can be downloaded from rubyforge: http://rubyforge.org/projects/monkeys/ Thinking from memory, create a Bitmap large enough for your work. When you want to update what appears on the screen (such as during a mouse drag), you create a MemoryDC, select the bitmap into the DC, and draw your own image into the DC. The paint handler simply blits from the memory DC into the paint DC. It would be nice if wxRuby had a Canvas class that did this for you. Kevin > > I am using wxRuby 0.6.0 on Win XP (Home) and Ruby installed using the > latest one-click Ruby installer. Code follows, image file (sk.png) > attached. > > TIA, > -- shanko > > ################# > require 'wxruby' > > class MyFrame < Wx::Frame > > def initialize(title) > super(nil, -1, title,Wx::DEFAULT_POSITION, Wx::Size.new(250,250)) > > image = Wx::Image.new("sk.png") > @bitmap = Wx::Bitmap.new(image) > @left_dn = false evt_paint { on_paint } > evt_motion {|event| on_motion(event) } > evt_left_down {|event| @left_dn = true } > evt_left_up {|event| @left_dn = false } > end > > def move_region(nx,ny) > > ox,oy,w,h = @reg.get_box > @reg.clear > @reg = Wx::Region.new(nx,ny,nx+w,ny+h) > dc = Wx::ClientDC.new(self) > # Erase from the existing location > # > wb = Wx::WHITE_BRUSH > dc.set_brush(wb) dc.set_pen(Wx::WHITE_PEN) > dc.draw_rectangle(ox,oy,ox+w,oy+h) # Draw at the new > location # > dc.draw_bitmap(@bitmap,nx,ny,false) dc.free end > > def on_motion(event) > > x = event.get_x > y = event.get_y > move_region(x,y) if (@left_dn and (@reg.contains(x,y) == 0)) > > end > > def on_paint > paint{|dc| > dc.clear > dc.draw_bitmap(@bitmap, 0, 0, false) > } > w,h = @bitmap.get_width, @bitmap.get_height > @reg = Wx::Region.new(0,0,w,h) > end > end > > class ImagesApp < Wx::App > > def on_init > frame = MyFrame.new("Simple Image Demo") > frame.show > end > > end > > Wx::init_all_image_handlers > a = ImagesApp.new > a.main_loop() > > __END__ > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From sdate at everestkc.net Sun Jan 23 00:01:27 2005 From: sdate at everestkc.net (Shashank Date) Date: Sat Jan 22 23:59:01 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F31490.1090802@qualitycode.com> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> Message-ID: <41F32FA7.7050804@everestkc.net> Kevin Smith wrote: > The test in on_motion looks odd. It seems that if the endpoint of the > drag event is still within the border of the image, the drag is > ignored. That means only drag events that start within the image but > end outside will actually cause dragging. That's it ! I don't know how that condition came to be (although I wrote it myself a while back :-)). So I rewrote it like this: # ..... def on_motion(event) x = event.get_x y = event.get_y w,h = @bitmap1.get_width, @bitmap1.get_height move_region(x-(w/2),y-(h/2)) if @left_dn end And now it is working quite like what I wanted. > You might want to set @left_dn true ONLY if the down event started > within the image. Then in on_motion if left_dn is true, do a move. At > that point you might rename the variable to @dragging. Why rename the variable? > Many programs that do this also capture the mouse. My mind is too > fuzzy right now to remember if that is necessary for your purposes. I do not know how to "capture the mouse". > Drawing directly to the screen is always very slow. You will almost > certainly want to use "double buffering", known in some graphics > toolkits as a "canvas". That's where you write to an off-screen > bitmap, and then just "blit" (transfer) the bitmap to the screen. I > don't think wx has a built-in canvas object, and I don't remember any > wxRuby examples using this, so you may have to do it yourself. I will take a look at it. > I think you can find an example in the Space Monkeys game I wrote a > while back. The code hasn't been updated, so it probably won't work > with a current version of wxRuby. But you can at least see the idea. > The tarball can be downloaded from rubyforge: > http://rubyforge.org/projects/monkeys/ > > Thinking from memory, create a Bitmap large enough for your work. When > you want to update what appears on the screen (such as during a mouse > drag), you create a MemoryDC, select the bitmap into the DC, and draw > your own image into the DC. > > The paint handler simply blits from the memory DC into the paint DC. Hmm ... I need to educate myself in such matters. Thanks for all the hints. > It would be nice if wxRuby had a Canvas class that did this for you. Yes, indeed ! > Kevin Thanks Kevin. -- shanko From sdate at everestkc.net Sun Jan 23 00:05:23 2005 From: sdate at everestkc.net (Shashank Date) Date: Sun Jan 23 00:02:47 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F32FA7.7050804@everestkc.net> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> <41F32FA7.7050804@everestkc.net> Message-ID: <41F33093.7010409@everestkc.net> Shashank Date wrote: >> You might want to set @left_dn true ONLY if the down event started >> within the image. Then in on_motion if left_dn is true, do a move. At >> that point you might rename the variable to @dragging. > > > Why rename the variable? After reading your email again, I think I understood what you meant by renaming the variable ... just so that it would be concerned with "dragging" and not merely a left_down. Right? -- shanko From wxruby at qualitycode.com Sun Jan 23 13:26:39 2005 From: wxruby at qualitycode.com (Kevin Smith) Date: Sun Jan 23 13:24:07 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F33093.7010409@everestkc.net> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> <41F32FA7.7050804@everestkc.net> <41F33093.7010409@everestkc.net> Message-ID: <41F3EC5F.7050700@qualitycode.com> Shashank Date wrote: > >>> You might want to set @left_dn true ONLY if the down event started >>> within the image. Then in on_motion if left_dn is true, do a move. At >>> that point you might rename the variable to @dragging. >> >> Why rename the variable? > > After reading your email again, I think I understood what you meant by > renaming the variable ... just so that it would be concerned with > "dragging" and not merely a left_down. Right? Exactly. It would no longer merely indicate that the left button is down. It would now indicate that a drag is in progress. > I do not know how to "capture the mouse". In wxWindows, it is called wxWindow::CaptureMouse (most/all gui toolkits have something similar). Basically, it directs all future mouse input to your handler, even if the mouse goes outside your window until you say otherwise. You probably do want/need to do it. When the left button is released to end the drag operation, you would call ReleaseMouse. I haven't checked, but I suspect wxRuby exposes Window#capture_mouse and release_mouse. Cheers, Kevin From sdate at everestkc.net Sun Jan 23 23:29:55 2005 From: sdate at everestkc.net (Shashank Date) Date: Sun Jan 23 23:27:15 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F3EC5F.7050700@qualitycode.com> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> <41F32FA7.7050804@everestkc.net> <41F33093.7010409@everestkc.net> <41F3EC5F.7050700@qualitycode.com> Message-ID: <41F479C3.3000000@everestkc.net> Kevin Smith wrote: > In wxWindows, it is called wxWindow::CaptureMouse (most/all gui > toolkits have something similar). Basically, it directs all future > mouse input to your handler, even if the mouse goes outside your > window until you say otherwise. You probably do want/need to do it. > When the left button is released to end the drag operation, you would > call ReleaseMouse. I haven't yet figured out how this will be needed ... see my (failed?) attempt in the code below. > I haven't checked, but I suspect wxRuby exposes Window#capture_mouse > and release_mouse. yes, there is. And now I am working on another problem: that of overlapping images. You see, I simulate the move of the image by erasing it from the current location and drawing it at the new location. But if the current location happens to overlap with another image (even partially), then that second image part gets erased permanently. Run the code below (images attached) to see what I mean. Again, I am doing this with no understanding of MemoryDC, so please forgive and correct me if I 'm heading in the wrong direction. > Cheers, > > Kevin Thanks, -- shanko ############################################## require 'wxruby' class MyFrame < Wx::Frame def initialize(title) super(nil, -1, title,Wx::DEFAULT_POSITION, Wx::Size.new(250,250)) image1 = Wx::Image.new("sk.png") @bitmap1 = Wx::Bitmap.new(image1) image2 = Wx::Image.new("sq.png") @bitmap2 = Wx::Bitmap.new(image2) @left_dn = false evt_paint { on_paint } evt_motion {|event| on_motion(event) } evt_left_down {|event| self.capture_mouse; @left_dn = true } evt_left_up {|event| self.release_mouse; @left_dn = false } end def move_region(nx,ny) ox,oy,w,h = @reg.get_box @reg.clear @reg = Wx::Region.new(nx,ny,nx+w,ny+h) dc = Wx::ClientDC.new(self) # Erase from the existing location # wb = Wx::WHITE_BRUSH dc.set_brush(wb) dc.set_pen(Wx::WHITE_PEN) dc.draw_rectangle(ox,oy,ox+w,oy+h) # Draw at the new location # dc.draw_bitmap(@bitmap1,nx,ny,false) dc.free end def on_motion(event) x = event.get_x y = event.get_y w,h = @bitmap1.get_width, @bitmap1.get_height move_region(x-(w/2),y-(h/2)) if @left_dn end def on_paint paint{|dc| dc.clear dc.draw_bitmap(@bitmap1, 0, 0, false) dc.draw_bitmap(@bitmap2, @bitmap1.get_width+5, 0, false) } @reg = Wx::Region.new(0,0,@bitmap1.get_width, @bitmap1.get_height) end end class ImagesApp < Wx::App def on_init frame = MyFrame.new("Simple Image Demo") frame.show end end Wx::init_all_image_handlers a = ImagesApp.new a.main_loop() __END__ -------------- next part -------------- A non-text attachment was scrubbed... Name: sq.png Type: image/png Size: 1040 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20050123/2c347497/sq.png -------------- next part -------------- A non-text attachment was scrubbed... Name: sk.png Type: image/png Size: 961 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20050123/2c347497/sk.png From devel at nicreations.com Sun Jan 23 23:57:17 2005 From: devel at nicreations.com (Nick) Date: Sun Jan 23 23:57:08 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F479C3.3000000@everestkc.net> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> <41F32FA7.7050804@everestkc.net> <41F33093.7010409@everestkc.net> <41F3EC5F.7050700@qualitycode.com> <41F479C3.3000000@everestkc.net> Message-ID: <41F4802D.5010304@nicreations.com> > > And now I am working on another problem: that of overlapping images. You > see, I simulate the move of the image by erasing it from the current > location and drawing it at the new location. But if the current location > happens to overlap with another image (even partially), then that second > image part gets erased permanently. > Run the code below (images attached) to see what I mean. Again, I am > doing this with no understanding of > MemoryDC, so please forgive and correct me if I 'm heading in the wrong > direction. If you do things with a client DC, then you will need to redraw everything affected. What you need is wxDragImage. I'll try to expose that. Nick Shashank Date wrote: > Kevin Smith wrote: > >> In wxWindows, it is called wxWindow::CaptureMouse (most/all gui >> toolkits have something similar). Basically, it directs all future >> mouse input to your handler, even if the mouse goes outside your >> window until you say otherwise. You probably do want/need to do it. >> When the left button is released to end the drag operation, you would >> call ReleaseMouse. > > > I haven't yet figured out how this will be needed ... see my (failed?) > attempt in the code below. > >> I haven't checked, but I suspect wxRuby exposes Window#capture_mouse >> and release_mouse. > > > yes, there is. > > And now I am working on another problem: that of overlapping images. You > see, I simulate the move of the image by erasing it from the current > location and drawing it at the new location. But if the current location > happens to overlap with another image (even partially), then that second > image part gets erased permanently. > Run the code below (images attached) to see what I mean. Again, I am > doing this with no understanding of > MemoryDC, so please forgive and correct me if I 'm heading in the wrong > direction. > >> Cheers, >> >> Kevin > > > Thanks, > -- shanko > > ############################################## > require 'wxruby' > > class MyFrame < Wx::Frame > > def initialize(title) > > super(nil, -1, title,Wx::DEFAULT_POSITION, Wx::Size.new(250,250)) > > image1 = Wx::Image.new("sk.png") > @bitmap1 = Wx::Bitmap.new(image1) > image2 = Wx::Image.new("sq.png") > @bitmap2 = Wx::Bitmap.new(image2) > @left_dn = false > evt_paint { on_paint } > evt_motion {|event| on_motion(event) } > evt_left_down {|event| self.capture_mouse; @left_dn = true } > evt_left_up {|event| self.release_mouse; @left_dn = false } > end > > def move_region(nx,ny) > > ox,oy,w,h = @reg.get_box > @reg.clear > @reg = Wx::Region.new(nx,ny,nx+w,ny+h) > dc = Wx::ClientDC.new(self) > # Erase from the existing location > # > wb = Wx::WHITE_BRUSH > dc.set_brush(wb) > dc.set_pen(Wx::WHITE_PEN) > dc.draw_rectangle(ox,oy,ox+w,oy+h) > # Draw at the new location > # > dc.draw_bitmap(@bitmap1,nx,ny,false) > dc.free end > > def on_motion(event) > > x = event.get_x > y = event.get_y > w,h = @bitmap1.get_width, @bitmap1.get_height > move_region(x-(w/2),y-(h/2)) if @left_dn > > end > > def on_paint > paint{|dc| > dc.clear > dc.draw_bitmap(@bitmap1, 0, 0, false) > dc.draw_bitmap(@bitmap2, @bitmap1.get_width+5, 0, false) > } > @reg = Wx::Region.new(0,0,@bitmap1.get_width, @bitmap1.get_height) > end > > end > > class ImagesApp < Wx::App > > def on_init > frame = MyFrame.new("Simple Image Demo") > frame.show > end > > end > > Wx::init_all_image_handlers > a = ImagesApp.new > a.main_loop() > > __END__ > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > _______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From wxruby at qualitycode.com Mon Jan 24 09:53:37 2005 From: wxruby at qualitycode.com (Kevin Smith) Date: Mon Jan 24 09:51:02 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F479C3.3000000@everestkc.net> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> <41F32FA7.7050804@everestkc.net> <41F33093.7010409@everestkc.net> <41F3EC5F.7050700@qualitycode.com> <41F479C3.3000000@everestkc.net> Message-ID: <41F50BF1.8070808@qualitycode.com> Shashank Date wrote: > Kevin Smith wrote: > >> In wxWindows, it is called wxWindow::CaptureMouse (most/all gui > > I haven't yet figured out how this will be needed ... see my (failed?) > attempt in the code below. Since I can't run the code from here, I'm not sure how it's failing. Without the capture/release, if you try to drag an image where the mouse cursor ends up outside the window area, it should stop moving until the mouse cursor returns to within your window. With capture/release, the image should keep moving no matter where your mouse cursor goes. > And now I am working on another problem: that of overlapping images. Nick mentioned wxDragImage, which I'm not familiar with, but certainly sounds promising. If I had to implement something without that, I would change the way the cards are drawn onto the background. I would have a Card class that tracks the card value (image) and location. Then, I would have a build_display method that would start with an empty bitmap and memory dc, would draw the background, then would draw each of the cards, in order (this allows some cards to be on top of others). Moving a card would actually blank and redraw the whole display (in memory, not on-screen). If that were too slow for some reason, then I would look for optimizations. One example of an optimization would be that when someone starts to drag a card, build an in-memory image of everything EXCEPT that card. That way, you can update the during-drag display by just copying that snapshot image and then drawing the moving card on top of it. But, again, I wouldn't do that unless it was necessary. Cheers, Kevin From sdate at everestkc.net Mon Jan 24 13:11:44 2005 From: sdate at everestkc.net (Shashank Date) Date: Mon Jan 24 13:09:11 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F4802D.5010304@nicreations.com> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> <41F32FA7.7050804@everestkc.net> <41F33093.7010409@everestkc.net> <41F3EC5F.7050700@qualitycode.com> <41F479C3.3000000@everestkc.net> <41F4802D.5010304@nicreations.com> Message-ID: <41F53A60.1020309@everestkc.net> Hi, Nick wrote: > If you do things with a client DC, then you will need to redraw > everything affected. What you need is wxDragImage. I'll try to expose > that. That will be great ! Thanks, > Nick -- shanko From sdate at everestkc.net Mon Jan 24 13:16:26 2005 From: sdate at everestkc.net (Shashank Date) Date: Mon Jan 24 13:13:45 2005 Subject: [Wxruby-users] Dragging images across the canvas In-Reply-To: <41F50BF1.8070808@qualitycode.com> References: <41F1E937.9060003@everestkc.net> <41F31490.1090802@qualitycode.com> <41F32FA7.7050804@everestkc.net> <41F33093.7010409@everestkc.net> <41F3EC5F.7050700@qualitycode.com> <41F479C3.3000000@everestkc.net> <41F50BF1.8070808@qualitycode.com> Message-ID: <41F53B7A.6020907@everestkc.net> Hi Kevin, Kevin Smith wrote: > Since I can't run the code from here, I'm not sure how it's failing. > Without the capture/release, if you try to drag an image where the > mouse cursor ends up outside the window area, it should stop moving > until the mouse cursor returns to within your window. With > capture/release, the image should keep moving no matter where your > mouse cursor goes. Oh, yes ! Now I see. In that case, my code is not failing.... :-) > Nick mentioned wxDragImage, which I'm not familiar with, but certainly > sounds promising. Yup... looking forward to it. > If I had to implement something without that, I would change the way > the cards are drawn onto the background. I would have a Card class > that tracks the card value (image) and location. Then, I would have a > build_display method that would start with an empty bitmap and memory > dc, would draw the background, then would draw each of the cards, in > order (this allows some cards to be on top of others). > > Moving a card would actually blank and redraw the whole display (in > memory, not on-screen). If that were too slow for some reason, then I > would look for optimizations. > > One example of an optimization would be that when someone starts to > drag a card, build an in-memory image of everything EXCEPT that card. > That way, you can update the during-drag display by just copying that > snapshot image and then drawing the moving card on top of it. But, > again, I wouldn't do that unless it was necessary. Excellent tips. While I am waiting for wxDragImage, I will try and implement them just to see how it works. > Cheers, Thanks again. > Kevin -- shanko