From lists at ruby-forum.com Mon Feb 1 06:45:34 2010 From: lists at ruby-forum.com (Tim Nicholson) Date: Mon, 1 Feb 2010 12:45:34 +0100 Subject: [wxruby-users] static gem of wxruby 2.0.1 for OS X Snow Leopard In-Reply-To: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> References: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> Message-ID: <8ae242f13cc8307a3fd8d8228a093497@ruby-forum.com> Antti Hakala wrote: > Hello, > I have a static gem of wxruby 2.0.1 that works on OS X Snow Leopard, > if somebody is interested. > I've tried it only on my own comp. It's about 9MB. Is this hosted anywhere yet? If not I would love a copy please to tsn at orange dot net -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Feb 1 11:24:05 2010 From: lists at ruby-forum.com (Alpha Blue) Date: Mon, 1 Feb 2010 17:24:05 +0100 Subject: [wxruby-users] Strange Issue with Wx_Sugar and xml.load In-Reply-To: <62dbb94cdedf82b0417679e4845d0519@ruby-forum.com> References: <91086babda054e956de214ebb427cc91@ruby-forum.com> <62dbb94cdedf82b0417679e4845d0519@ruby-forum.com> Message-ID: <8c197a34801f59d766ecc04490e6252e@ruby-forum.com> Okay, I figured it out, but it's a really weird issue. I decided to put the following in the generated ruby file that xrcise generates: begin xml.load("ui/ui.xrc") rescue xml.load(Dir.getwd + "/ui/ui.xrc") end When I built the app and ran the app from my desktop: Cannot load resources from C:/users/joel/desktop/ui/ui.xrc. So, I created a folder called ui on my desktop and placed the xrc source in there and it works. I went back to the generated ruby file, removed the rescue statement completely and left it just as: xml.load("ui/ui.xrc") And rebuilt the app and tried again from my desktop. It worked, because there was a ui/ui.xrc file on my desktop. This is very strange because when using xml.load it appears it's looking in the current working directory and not the temp directory that ocra unpacks everything into. So, I'm not sure how to change the working directory to the temp directory that ocra creates when you launch the executable. Is this a bug with xml.load? Or a bug with Ocra? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Feb 1 11:42:31 2010 From: lists at ruby-forum.com (Alpha Blue) Date: Mon, 1 Feb 2010 17:42:31 +0100 Subject: [wxruby-users] Strange Issue with Wx_Sugar and xml.load In-Reply-To: <8c197a34801f59d766ecc04490e6252e@ruby-forum.com> References: <91086babda054e956de214ebb427cc91@ruby-forum.com> <62dbb94cdedf82b0417679e4845d0519@ruby-forum.com> <8c197a34801f59d766ecc04490e6252e@ruby-forum.com> Message-ID: In order to fix the issue, I had to replace the xml.load with: xml.load(File.join(File.dirname(__FILE__),"ui.xrc")) .. which while fixable, means that anytime I want to port an application using xrcise, I have to hack the generated file. I wonder if they realize that load is not like require and that it generally should be used with absolute paths? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Feb 1 11:56:03 2010 From: lists at ruby-forum.com (Alpha Blue) Date: Mon, 1 Feb 2010 17:56:03 +0100 Subject: [wxruby-users] Strange Issue with Wx_Sugar and xml.load In-Reply-To: References: <91086babda054e956de214ebb427cc91@ruby-forum.com> <62dbb94cdedf82b0417679e4845d0519@ruby-forum.com> <8c197a34801f59d766ecc04490e6252e@ruby-forum.com> Message-ID: <8b045870bf54e702dcef1e2f0e711427@ruby-forum.com> Reported this in a bug ticket: http://rubyforge.org/tracker/index.php?func=detail&aid=27762&group_id=35&atid=218 Ticket # 27762 -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Feb 1 13:37:13 2010 From: lists at ruby-forum.com (=?utf-8?Q?Marvin_G=c3=bclker?=) Date: Mon, 1 Feb 2010 19:37:13 +0100 Subject: [wxruby-users] Compiling problem on Ubuntu 9.10 64 bit In-Reply-To: <9797c10c9ad91c94e9367a8e340d9a46@ruby-forum.com> References: <51676e8059b9d963a30fb3a02c64f7e9@ruby-forum.com> <12760e534b7152c4ff245f2e2b58cfd3@ruby-forum.com> <9797c10c9ad91c94e9367a8e340d9a46@ruby-forum.com> Message-ID: Sorry for the late answer, I've been cut off from the Internet for the last days... Carlo Bertini wrote: > this is the gem : > svn version: 2107 > http://www.waydotnet.com/ruby/wxruby-ruby19-2.0.1.dev-x86_64-linux.gem > > without StyledTextCtrl > > Only problem when install without --no-rdoc > > Carlo Bertini That works awesome! Thank you! Carlo Bertini wrote: > from http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets I couldn't get wxRuby to compile. After compiling wxWidgets with the long term you (or the wxRuby wiki) suggested (with the extra 64-bit options) passed to the configure script and the "ugly hack" described at http://trac.wxwidgets.org/ticket/10883 the error I posted still persists. However, your gem works, so thank you! Marvin -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Feb 1 15:16:23 2010 From: lists at ruby-forum.com (Carlo Bertini) Date: Mon, 1 Feb 2010 21:16:23 +0100 Subject: [wxruby-users] Compiling problem on Ubuntu 9.10 64 bit In-Reply-To: References: <51676e8059b9d963a30fb3a02c64f7e9@ruby-forum.com> <12760e534b7152c4ff245f2e2b58cfd3@ruby-forum.com> <9797c10c9ad91c94e9367a8e340d9a46@ruby-forum.com> Message-ID: <82f308d44ad97efab8adf88a3eda08e1@ruby-forum.com> Marvin G?lker wrote: > > However, your gem works, so thank you! > Nothing :D Carlo Bertini www.waydotnet.com -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Feb 4 09:22:16 2010 From: lists at ruby-forum.com (Lui Kore) Date: Thu, 4 Feb 2010 15:22:16 +0100 Subject: [wxruby-users] Suggestions to reduce binary size, make loading faster Message-ID: I found wxruby2.so in mingw release a bit large (18M), it is smaller (~15M) after stripping symbols. I learned this from http://wiki.wxwidgets.org/Reducing_Executable_Size . The command line is: strip --strip-all wxruby2.so But I don't know whether there is a problem with stripping, at least my app still runs well with the stripped one. --- The loading of wxruby is not very fast too(~ 1.3s on my machine). After a small profile, I found the following code in wx.rb the bottle-neck: require 'wx/classes/evthandler.rb' class_files = File.join( File.dirname(__FILE__), 'wx', 'classes', '*.rb') Dir.glob(class_files) do | class_file | require 'wx/classes/' + class_file[/\w+\.rb$/] end A simple improvement is to make wx/classes/*.rb into one. I wrote the following script, placed it under wx/, then run it to generate a new classes.rb containing most classes under wx/classes/ data = [] (Dir.glob('classes/*.rb') - [ 'classes/evthandler.rb', 'classes/simplehelpprovider.rb', 'classes/bitmap.rb' ]).each do |f| data.push File.read f end File.open 'classes.rb', 'w' do |f| f.puts data.join "\n" end Then I changed the classes loading section in wx.rb with: require 'wx/classes/evthandler.rb' require 'wx/classes.rb' After this modification, the loading time seems shorter (reduced to ~ 0.4s on my machine). -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Feb 4 12:51:31 2010 From: lists at ruby-forum.com (Valentine Bichkovsky) Date: Thu, 4 Feb 2010 18:51:31 +0100 Subject: [wxruby-users] DC#draw_bitmap with logical_function on Windows Message-ID: <6e2b38b5d42516db28eca68a46f8488e@ruby-forum.com> Hi! While testing the app I developed (on Linux), I encountered strange behaviour on Windows for this method: def draw(dc, x, y) dc.pen = Wx::TRANSPARENT_PEN dc.logical_function = Wx::COPY if @bitmap dc.draw_bitmap(@bitmap, x, y, false) else dc.brush = Wx::GREY_BRUSH dc.draw_rectangle(x, y, TILE_WIDTH, TILE_WIDTH) end if @mask dc.logical_function = Wx::AND dc.draw_bitmap(@mask, x, y, false) end end On Linux (Ubuntu 9.10, Ruby 1.8.7, wxRuby 2.0.1) @mask is drawn correctly, while on Windows (XP SP 2, Ruby 1.8.6, with 'backports' gem) it is drawn as if logical_function was Wx::COPY. For now, I wrote a workaround which works for Windows: module Wx class DC def draw_bitmap(bitmap, x, y, draw_transp) m = MemoryDC.new m.select_object(bitmap) self.blit(x, y, bitmap.width, bitmap.height, m, 0, 0, self.logical_function, draw_transp) m.select_object(Wx::NULL_BITMAP) end end end It this a bug or a platform feature? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Feb 4 12:57:08 2010 From: lists at ruby-forum.com (Valentine Bichkovsky) Date: Thu, 4 Feb 2010 18:57:08 +0100 Subject: [wxruby-users] Wx::Choice in Windows Message-ID: <0b54907017b281f9239e4ddf27c39aab@ruby-forum.com> Hi! While testing my wxRuby app on Windows, I found that Wx::Choice behaves differently under Linux and Windows. For this line of code @tpf_choice = Wx::Choice.new(self, :choices => %w(1 8 16 32 64 256)) in Linux, the first choice '1' is pre-selected, while in Windows nothing is selected until I open the list and select a value from it. After that, blank value cannot be selected. Is it a bug? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Feb 4 23:56:00 2010 From: lists at ruby-forum.com (Pat Kiatchaipipat) Date: Fri, 5 Feb 2010 05:56:00 +0100 Subject: [wxruby-users] question about wxbutton? Message-ID: <32edea420c702e15b16acd1c0bf4a346@ruby-forum.com> hello, I have some question. when I use wxbutton. the button is a simple window system theme how can I change this button to window vista button style? and how can I remove cmd box in background? see picture for more details. thank you:) Attachments: http://www.ruby-forum.com/attachment/4458/fff.jpg -- Posted via http://www.ruby-forum.com/. From penguinroad at gmail.com Fri Feb 5 00:46:02 2010 From: penguinroad at gmail.com (hendra kusuma) Date: Fri, 5 Feb 2010 12:46:02 +0700 Subject: [wxruby-users] question about wxbutton? In-Reply-To: <32edea420c702e15b16acd1c0bf4a346@ruby-forum.com> References: <32edea420c702e15b16acd1c0bf4a346@ruby-forum.com> Message-ID: <26dadb3d1002042146n3d53ad2ex483bf829b2d724f6@mail.gmail.com> I'm not sure about vista style button since I don't use vista but in xp there is a way to make the button using xp style, by adding some xml file into ruby/bin directory. Perhaps another who use vista can help? about remove cmd box in background, try changing your file extension from .rb to .rbw On Fri, Feb 5, 2010 at 11:56 AM, Pat Kiatchaipipat wrote: > hello, I have some question. > > when I use wxbutton. the button is a simple window system theme how can > I change this button to window vista button style? > > and how can I remove cmd box in background? > > see picture for more details. > > thank you:) > > Attachments: > http://www.ruby-forum.com/attachment/4458/fff.jpg > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Suka linux? Kunjungi blog saya http://penguinroad.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Fri Feb 5 00:51:33 2010 From: penguinroad at gmail.com (hendra kusuma) Date: Fri, 5 Feb 2010 12:51:33 +0700 Subject: [wxruby-users] Wx::Choice in Windows In-Reply-To: <0b54907017b281f9239e4ddf27c39aab@ruby-forum.com> References: <0b54907017b281f9239e4ddf27c39aab@ruby-forum.com> Message-ID: <26dadb3d1002042151k3298dccfx8956ed09fd7b2d37@mail.gmail.com> I suggest you add set_selection to make sure that 1st value is pre-selected I don't know about you, but I would rather play save when it comes to programming, especially cross platform and since I am not the developer of this great library (just a user) I cannot help you any otherway On Fri, Feb 5, 2010 at 12:57 AM, Valentine Bichkovsky wrote: > Hi! > While testing my wxRuby app on Windows, I found that Wx::Choice behaves > differently under Linux and Windows. For this line of code > > @tpf_choice = Wx::Choice.new(self, :choices => %w(1 8 16 32 64 256)) > > in Linux, the first choice '1' is pre-selected, while in Windows nothing > is selected until I open the list and select a value from it. After > that, blank value cannot be selected. > Is it a bug? > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Suka linux? Kunjungi blog saya http://penguinroad.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri Feb 5 01:05:07 2010 From: lists at ruby-forum.com (Pat Kiatchaipipat) Date: Fri, 5 Feb 2010 07:05:07 +0100 Subject: [wxruby-users] question about wxbutton? In-Reply-To: <26dadb3d1002042146n3d53ad2ex483bf829b2d724f6@mail.gmail.com> References: <32edea420c702e15b16acd1c0bf4a346@ruby-forum.com> <26dadb3d1002042146n3d53ad2ex483bf829b2d724f6@mail.gmail.com> Message-ID: thank for the answer to remove cmd box it's work! but I try to searching the way to change button style someone know? :'( -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri Feb 5 16:58:23 2010 From: alex at pressure.to (Alex Fenton) Date: Fri, 05 Feb 2010 21:58:23 +0000 Subject: [wxruby-users] Wx::Choice in Windows In-Reply-To: <0b54907017b281f9239e4ddf27c39aab@ruby-forum.com> References: <0b54907017b281f9239e4ddf27c39aab@ruby-forum.com> Message-ID: <4B6C947F.9020703@pressure.to> On 04/02/2010 17:57, Valentine Bichkovsky wrote: > Hi! > While testing my wxRuby app on Windows, I found that Wx::Choice behaves > differently under Linux and Windows. For this line of code > > @tpf_choice = Wx::Choice.new(self, :choices => %w(1 8 16 32 64 256)) > > in Linux, the first choice '1' is pre-selected, while in Windows nothing > is selected until I open the list and select a value from it. After > that, blank value cannot be selected. > Is it a bug? > Thanks for the report. It's always been this way, and is so too in wxWidgets. I don't think it's a bug but rather a difference in the way the native control works on each platform. But, yes, it can be surprising. cheers alex From alex at pressure.to Fri Feb 5 17:01:26 2010 From: alex at pressure.to (Alex Fenton) Date: Fri, 05 Feb 2010 22:01:26 +0000 Subject: [wxruby-users] question about wxbutton? In-Reply-To: <32edea420c702e15b16acd1c0bf4a346@ruby-forum.com> References: <32edea420c702e15b16acd1c0bf4a346@ruby-forum.com> Message-ID: <4B6C9536.8050006@pressure.to> On 05/02/2010 04:56, Pat Kiatchaipipat wrote: > when I use wxbutton. the button is a simple window system theme how can > I change this button to window vista button style? > Try these steps here: http://rubyonwindows.blogspot.com/2007/10/windows-xp-visual-style-controls-with.html This blog suggests that wxWidgets by and large supports Vista-style widgets out the box: http://wxwidgets.blogspot.com/2007/02/wxwidgets-under-vista.html cheers alex From lists at ruby-forum.com Sat Feb 6 22:49:13 2010 From: lists at ruby-forum.com (Alpha Blue) Date: Sun, 7 Feb 2010 04:49:13 +0100 Subject: [wxruby-users] Need some help with a text control event Message-ID: If you have a static text control: @static_text_control .. which extends into a module: module SomeModule def some_event(label) self.set_label(label) end end and you are firing off events from other text controls using: @static_text_control.some_event("some updated text here") .. the above works fine.. But, how do you force the same method to fire from a non-text control event? def some_custom_method @static_text_control.some_event("some new label") end @static_text_control is now nil:NilClass.. My issue is how to mimic a static text control update from another method that is not a text control, but more of a string variable. I've tried many different things but nothing has worked. I could use some help. The @static_text_control will be holding approx. 8 separate and distinct labels. Right now I have it processing 4 separate labels fine and without issues. The problem I have now is the next 4 labels are just going to be string variables and I don't know how to force that method to notice and update them, or how to call a particular event from a non-text control. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Feb 7 10:13:42 2010 From: lists at ruby-forum.com (Alpha Blue) Date: Sun, 7 Feb 2010 16:13:42 +0100 Subject: [wxruby-users] Need some help with a text control event In-Reply-To: References: Message-ID: <0a7fcab095639c55c106b2eca45d1f26@ruby-forum.com> Nevermind, as always, with a little patience and resolve, I figured it out. The object instance variable was being called from the extended module and not from the public instance methods. Therefore, it could not be recognized. I just created a dual method call on the block itself: evt_list_item_right_click(@list_sites.get_id()) {|event| @list_sites.on_item_rightclicked(event) @builder_text.update_label } So, the list control which manages a right click event that calls a popup menu still functions and when the person clicks on the popup menu, the update level method is called on the builder text object correctly. I hope this helps someone else out down the road. Take care. -- Posted via http://www.ruby-forum.com/. From chauk.mean at gmail.com Mon Feb 8 13:17:45 2010 From: chauk.mean at gmail.com (Chauk-Mean Proum) Date: Mon, 8 Feb 2010 19:17:45 +0100 Subject: [wxruby-users] Suggestions to reduce binary size, make loading faster In-Reply-To: References: Message-ID: Hi Lui, 2010/2/4 Lui Kore : > I found wxruby2.so in mingw release a bit large (18M), it is smaller > (~15M) after stripping symbols. I learned this from > http://wiki.wxwidgets.org/Reducing_Executable_Size . The command line > is: > > ? ?strip --strip-all wxruby2.so We already use strip -x. But strip --strip-all seems to reduce the size a little more. I'll try and see if there is no problem. > The loading of wxruby is not very fast too(~ 1.3s on my machine). After > a small profile, I found the following code in wx.rb the bottle-neck: > > ? ?require 'wx/classes/evthandler.rb' > ? ?class_files = File.join( File.dirname(__FILE__), 'wx', 'classes', > '*.rb') > ? ?Dir.glob(class_files) do | class_file | > ? ? ?require 'wx/classes/' + class_file[/\w+\.rb$/] > ? ?end > > A simple improvement is to make wx/classes/*.rb into one. > I wrote the following script, placed it under wx/, then run it to > generate a new classes.rb containing most classes under wx/classes/ Interesting. I'll take a look at it. Cheers. Chauk-Mean. From lists at ruby-forum.com Fri Feb 12 08:03:29 2010 From: lists at ruby-forum.com (=?utf-8?Q?Marvin_G=c3=bclker?=) Date: Fri, 12 Feb 2010 14:03:29 +0100 Subject: [wxruby-users] question about wxbutton? In-Reply-To: <4B6C9536.8050006@pressure.to> References: <32edea420c702e15b16acd1c0bf4a346@ruby-forum.com> <4B6C9536.8050006@pressure.to> Message-ID: <8d21366726dc97bb36e231749d12d483@ruby-forum.com> Alex Fenton wrote: > On 05/02/2010 04:56, Pat Kiatchaipipat wrote: >> when I use wxbutton. the button is a simple window system theme how can >> I change this button to window vista button style? >> > Try these steps here: > > http://rubyonwindows.blogspot.com/2007/10/windows-xp-visual-style-controls-with.html > > This blog suggests that wxWidgets by and large supports Vista-style > widgets out the box: > > http://wxwidgets.blogspot.com/2007/02/wxwidgets-under-vista.html > > cheers > alex Some time ago I encountered the same problem and was given a solution: http://www.ruby-forum.com/topic/190390#new Additionally, I checked what happens if the script is compiled with OCRA and found that, if you include the manifest via the -dll option, the correct styles were used automatically. > and how can I remove cmd box in background Run the script with rubyw.exe, but beware that every attempt to write to $stdout (unless you redirected it) will now result in an error. The old OCI used to run scipts with the .rbw extension with rubyw.exe, but for the new RubyInstaller I don't know. What's your Ruby version? Marvin -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Feb 14 02:39:22 2010 From: lists at ruby-forum.com (Edgar J. Suarez) Date: Sun, 14 Feb 2010 08:39:22 +0100 Subject: [wxruby-users] static gem of wxruby 2.0.1 for OS X Snow Leopard In-Reply-To: <8ae242f13cc8307a3fd8d8228a093497@ruby-forum.com> References: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> <8ae242f13cc8307a3fd8d8228a093497@ruby-forum.com> Message-ID: <29b6a545e33ffb7b9518b725f0928a05@ruby-forum.com> Tim Nicholson wrote: > Antti Hakala wrote: >> Hello, >> I have a static gem of wxruby 2.0.1 that works on OS X Snow Leopard, >> if somebody is interested. >> I've tried it only on my own comp. It's about 9MB. > > Is this hosted anywhere yet? > If not I would love a copy please to > tsn at orange dot net +1 for the hosted file. in the mean time could send it to: edgar.js at gmail dot com ? Thanks! -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Feb 14 20:24:05 2010 From: lists at ruby-forum.com (Michael Satterwhite) Date: Mon, 15 Feb 2010 02:24:05 +0100 Subject: [wxruby-users] Ending Application When Window Closes Message-ID: OK, I *KNOW* I've got a case of tunnel vision here. I've written apps that use wxRuby without a problem. Regardless, I don't see what I'm doing wrong here. The code in my main routine looks like this: class MyApp < Wx::App def on_init f = Video.new(nil) f.show end end app = MyApp.new app.main_loop There is only one simple window in the app - created via wxFormBuilder. The window (a frame) displays cleanly. Problem: when I close this window (either by clicking the "X" or by issuing a call to self.close() through an event, the app doesn't exit. It simply goes to sleep. The only way I see to close it is to go to a terminal and issue a "kill" command. I'm running under Ubuntu 9.10. Would someone be so kind as to point out what I'm missing - which I'm sure is going to be obvious to everyone but me. -- Posted via http://www.ruby-forum.com/. From idan.miller at gmail.com Tue Feb 16 09:20:14 2010 From: idan.miller at gmail.com (Idan Miller) Date: Tue, 16 Feb 2010 16:20:14 +0200 Subject: [wxruby-users] Registering custom events Message-ID: <67cee7201002160620m4868ac29se0ac9e914050dd28@mail.gmail.com> Hi everyone, I'm using the following code to try and register custom events: When the commented line is uncommented, I the program crashes. I'm running on windows xp. Anyone know what am I doing wrong? Thanks, Idan. ----------------- require 'wx' class CustomCommandEvent < Wx::CommandEvent end class RecorderFrame < Wx::Frame def initialize(parent, id, title, hwnds, scriptFilename, fieldsFilename) super(parent, id, title) @hwnds = hwnds @scriptFilename = scriptFilename @fieldsFilename = fieldsFilename layout = Wx::BoxSizer.new(Wx::VERTICAL) set_sizer(layout) @startButton = Wx::Button.new(self, Wx::ID_ANY, "Start") @stopButton = Wx::Button.new(self, Wx::ID_ANY, "Stop") @label = Wx::StaticText.new(self, Wx::ID_ANY, "Preparing...") @startButton.disable @stopButton.disable evt_button @startButton, :startTracing evt_button @stopButton, :stopTracing layout.add(@startButton, 0, Wx::ALL|Wx::EXPAND, 1) layout.add(@stopButton, 0, Wx::ALL|Wx::EXPAND, 1) layout.add(@label, 0, Wx::ALL|Wx::EXPAND, 1) evt_close { |event| onClose(event) } evt_custom_commands { |event| onCustomCommand(event) } show end def onCustomCommand(event) puts ("Received command event, id: #{event.inspect.to_s}") end def onClose(event) if (event.can_veto) #TODO: Constants confirm = Wx::MessageDialog.new(nil, "Are you sure you want to stop recording?", "Stop Recording", Wx::OK | Wx::CANCEL) case confirm.show_modal when Wx::ID_OK destroy when Wx::ID_CANCEL event.veto end else destroy end end def startTracing end def stopTracing end end class WebRecorderApp < Wx::App attr_reader :frame def initialize(hwnds, scriptFilename, fieldsFilename) @hwnds = hwnds @scriptFilename = scriptFilename @fieldsFilename = fieldsFilename super() end def on_init @frame = RecorderFrame.new(nil, Wx::ALL, "Test", @hwnds, @scriptFilename, @fieldsFilename) end end #Wx::EvtHandler.register_class(CustomCommandEvent, nil, "evt_custom_commands", 1) app = WebRecorderApp.new(nil, nil, nil) app.main_loop --------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Tue Feb 16 22:59:58 2010 From: penguinroad at gmail.com (hendra kusuma) Date: Wed, 17 Feb 2010 10:59:58 +0700 Subject: [wxruby-users] weird style error Message-ID: <26dadb3d1002161959x7f3f0c18i101d630d836f3fd@mail.gmail.com> Dear all @text_108 = TextCtrl.new(@panel_106, -1, "", DEFAULT_POSITION, DEFAULT_SIZE, TE_PROCESS_ENTER|TE_RIGHT, DEFAULT_VALIDATOR) Why is that line up there give me error uninitialized constant Main::TE_RIGHT (NameError) same case happen with TE_CENTRE but runs ok with TE_LEFT I use Ubuntu 9.10 with ruby 1.8.7 with gem from previous thread on this mailist Regards Hendra -- Suka linux? Kunjungi blog saya http://penguinroad.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Wed Feb 17 02:25:02 2010 From: penguinroad at gmail.com (hendra kusuma) Date: Wed, 17 Feb 2010 14:25:02 +0700 Subject: [wxruby-users] date time picker Message-ID: <26dadb3d1002162325k3cbfc5cfofc0f15065a208e5d@mail.gmail.com> Sorry, stupid question I know in Wx there is a date time picker (textbox with button to show calendar) I already create that using xrc file now i want to create it without using xrc What is the class name? I cannot find it Thank you Regards Hendra -- Suka linux? Kunjungi blog saya http://penguinroad.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Wed Feb 17 09:53:11 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 17 Feb 2010 14:53:11 -0000 Subject: [wxruby-users] date time picker In-Reply-To: <26dadb3d1002162325k3cbfc5cfofc0f15065a208e5d@mail.gmail.com> References: <26dadb3d1002162325k3cbfc5cfofc0f15065a208e5d@mail.gmail.com> Message-ID: <007b01caafe0$ed9f0fc0$c8dd2f40$@to> Hi Hendra > I know in Wx there is a date time picker (textbox with button to show calendar) > I already create that using xrc file > now i want to create it without using xrc > What is the class name? Wx::DatePickerCtrl Cheers alex From penguinroad at gmail.com Wed Feb 17 22:39:59 2010 From: penguinroad at gmail.com (hendra kusuma) Date: Thu, 18 Feb 2010 10:39:59 +0700 Subject: [wxruby-users] date time picker In-Reply-To: <007b01caafe0$ed9f0fc0$c8dd2f40$@to> References: <26dadb3d1002162325k3cbfc5cfofc0f15065a208e5d@mail.gmail.com> <007b01caafe0$ed9f0fc0$c8dd2f40$@to> Message-ID: <26dadb3d1002171939r11de6434t9edbafbb4b91bd06@mail.gmail.com> Thank you You are always very helpful On Wed, Feb 17, 2010 at 9:53 PM, Alex Fenton wrote: > Wx::DatePickerCtrl > -- Suka linux? Kunjungi blog saya http://penguinroad.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu Feb 18 15:37:25 2010 From: lists at ruby-forum.com (=?utf-8?Q?Ois=c3=adn_Mac_fheara=c3=ad?=) Date: Thu, 18 Feb 2010 21:37:25 +0100 Subject: [wxruby-users] Refreshing Window In-Reply-To: References: <96db5804325aa3422347a7c9428477b2@ruby-forum.com> <20090607063024.3745c7c0@cybert.demosophia.net> Message-ID: Mario Steele wrote: > It should also be noted, that with this setup, is optimal for Ruby 1.8 > series. The reason for this, and the reason for the Timer in the first > place for this method, is that in Ruby 1.8 series, Threads are green > threads. Meaning that they are software layer threads. They are > entirely > managed by the Ruby interpreter itself, and never goes out to the > Operating > System itself to control the thread. This is where you have quite a few > problems with Wx::Ruby, and Ruby itself. Now the reason why it's > limited to > the Ruby 1.8 Series, and earlier actually, is cause the Ruby 1.9 series, > to > be dubbed 2.0, uses Operating System Threads. And as Alex has explained > to > me on this subject, You can create threads in Ruby 1.9, and Wx::Ruby, > and > things will work, as long as you keep any updates that you do the GUI in > the > Main Thread. So if you need to update a progress bar, or display some > text > in a window, it's best to do that in the main thread, and not the > sub-thread > that you create for the processing of the file. Perhaps it's a problem with the OS X implementation (1.9.1p376), but so far I'm not getting any better results with threads in Ruby 1.9... I start a thread from a Wx::App on_init like follows: Thread.new do loop do puts "1: #{Time.new}" puts "1b: #{Time.new}" puts "1c: #{Time.new}" puts "1d: #{Time.new}" ... And once started, the output looks like: 1: 2010-02-18 20:18:47 +0000 1b: 2010-02-18 20:18:48 +0000 1c: 2010-02-18 20:18:51 +0000 1d: 2010-02-18 20:18:55 +0000 This is quite amazingly slow - I guess the call to Time.new and .to_s/puts blocks and the thread sleeps, but up to 4 seconds between simple expressions is a lot! Using the Timer hack to cooperatively schedule the threads seems to work, just like in Ruby 1.8. Ois?n -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Feb 22 12:28:37 2010 From: lists at ruby-forum.com (Tony Meier) Date: Mon, 22 Feb 2010 18:28:37 +0100 Subject: [wxruby-users] GridCellNumberEditor peculiarities Message-ID: <84bfac65f005dcd32539881a0b53f244@ruby-forum.com> Hi, I'm using wxruby 2.0.1 w/ Ruby 1.8.7 on OS X 10.6.2. So far I have successfully implemented a grid with bool, choice and text edit controls. To combine the edit code with my app, I have subclassed the editor controls to get hooks for the begin_edit/end_edit events. This worked fine for the GridCellTextEditor and the GridCellChoiceEditor. My problem is, that I can't seem to get events for the GridCellNumberEditor. Find attached the modified grid example with subclassed controls. I'm getting the begin_edit/end_edit outputs for the choice control but not for the number control. To reproduce, start the application, click the choice editor and select a value. Note the console output that occurs on begin and end edit. Now click the number editor and change the number using the spin control. Notice how there is NO console output although the editor has been instantiated earlier. What's wrong? Is there another, preferable way of integrating a control's events into an application to generate callbacks and allow for value vetoes? Thanks in advance, Tony -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Feb 22 12:30:23 2010 From: lists at ruby-forum.com (Tony Meier) Date: Mon, 22 Feb 2010 18:30:23 +0100 Subject: [wxruby-users] GridCellNumberEditor peculiarities In-Reply-To: <84bfac65f005dcd32539881a0b53f244@ruby-forum.com> References: <84bfac65f005dcd32539881a0b53f244@ruby-forum.com> Message-ID: <60725e8f245f906a106951710389d16e@ruby-forum.com> here's the code (I can't seem to attach it) [code] begin require 'rubygems' rescue LoadError end require 'wx' class MyNumberEditor < Wx::GridCellNumberEditor def initialize(min, max) super puts "creating number editor" end def begin_edit row, col, grid puts "begin edit" super end def end_edit row, col, grid puts "end edit" super end end class MyChoiceEditor < Wx::GridCellChoiceEditor def initialize choices puts "choice init" super end def begin_edit(row, col, grid) puts "choice begin edit" super end def end_edit(row, col, grid) puts "choice end edit w/ value #{get_value()}" super end end class GridFrame < Wx::Frame def initialize(parent, id = -1, title = "MyFrame", pos = Wx::DEFAULT_POSITION, size = Wx::DEFAULT_SIZE, style = Wx::DEFAULT_FRAME_STYLE) super(parent, id, title, pos, size, style) sizer = Wx::BoxSizer.new(Wx::VERTICAL) set_status_text(Wx::VERSION_STRING) make_grid(self) sizer.add(@grid, 1, Wx::ALL|Wx::GROW, 4) set_sizer(sizer) end def make_grid(panel) @grid = Wx::Grid.new(panel, -1) @grid.create_grid( 20, 12 ) @grid.set_default_cell_background_colour(Wx::WHITE) editor = MyNumberEditor.new(7,23) @grid.set_cell_value(3, 1, 'Number editor below') @grid.set_cell_editor(4, 1, editor) editor = MyChoiceEditor.new(['foo', 'bar', 'baz']) @grid.set_cell_value(3, 3, 'Choice editor below') @grid.set_cell_editor(4, 3, editor) @grid.auto_size_row(3, true) end end class GridApp < Wx::App def on_init frame = GridFrame.new(nil, -1, "Grid Sample", Wx::Point.new(10, 100), Wx::Size.new(630,400)) set_top_window(frame) frame.show() end end GridApp.new.main_loop() [/code] -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Feb 23 10:27:44 2010 From: lists at ruby-forum.com (Tony Meier) Date: Tue, 23 Feb 2010 16:27:44 +0100 Subject: [wxruby-users] =?utf-8?q?How_to_make_a_Grid_reread_the_number_of_?= =?utf-8?q?rows_in_a=09Table=3F?= In-Reply-To: <20091211220830.1592f1c7@cybert.demosophia.net> References: <20091205192902.700bf752@cybert.demosophia.net> <4B1B3D9E.5070704@pressure.to> <20091206165012.37809f64@cybert.demosophia.net> <20091211220830.1592f1c7@cybert.demosophia.net> Message-ID: <8c02c9a4e2b8a30168e9d53d0ddb9e8f@ruby-forum.com> > Okay I solved it by dropping the table and making a subclass of Grid. > And then using 'append_rows' and 'delete_rows' from the Grid class. > > It seems like 'set_table' in Grid makes a clone of the table, and > thereby make it impossible to manipulate the table directly. Can anyone confirm this is the way to go? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Feb 24 14:32:16 2010 From: lists at ruby-forum.com (Tony Meier) Date: Wed, 24 Feb 2010 20:32:16 +0100 Subject: [wxruby-users] =?utf-8?q?How_to_make_a_Grid_reread_the_number_of_?= =?utf-8?q?rows_in_a=09Table=3F?= In-Reply-To: <8c02c9a4e2b8a30168e9d53d0ddb9e8f@ruby-forum.com> References: <20091205192902.700bf752@cybert.demosophia.net> <4B1B3D9E.5070704@pressure.to> <20091206165012.37809f64@cybert.demosophia.net> <20091211220830.1592f1c7@cybert.demosophia.net> <8c02c9a4e2b8a30168e9d53d0ddb9e8f@ruby-forum.com> Message-ID: <2ee8baa60f50e1b9efbf412abff4042d@ruby-forum.com> Tony Meier wrote: > Can anyone confirm this is the way to go? Answering my own question - yes, that seems to do the trick. When the underlying data changes, simply create a new table (a subclass of GridTableBase to be exact) and call mygrid.set_table again. Voila. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Feb 24 14:39:27 2010 From: lists at ruby-forum.com (Tony Meier) Date: Wed, 24 Feb 2010 20:39:27 +0100 Subject: [wxruby-users] Mouse wheel events in a grid cell editor? Message-ID: I'm trying to do some advanced editing using Grids. I've created my own editors and updating view and model both works fine so far. Thanks to whoever made this possible. I like wxRuby more each day! Now I'd like to catch mousewheel events in order to increment/decrement a grid cell editor. I've tried installing a handler in begin_edit of my editor and removing it again in end_edit. I've attempted to (a) install an event handler on the grid and forward it to an editor-specific method (b) install an event handler on the editor control Neither approach worked. Any suggestions? Thanks in advance, Tony --- class MyEditor < Wx::GridCellChoiceEditor def initialize super end def begin_edit row, col, grid get_control().evt_mousewheel {|e| on_wheel e } grid.evt_mousewheel {|e| on_wheel e } end def on_wheel event p event end def end_edit row, col, grid # TODO: unsubscribe evt handler super end end -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Feb 24 15:36:38 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 24 Feb 2010 20:36:38 +0000 Subject: [wxruby-users] How to make a Grid reread the number of rows in a Table? In-Reply-To: <8c02c9a4e2b8a30168e9d53d0ddb9e8f@ruby-forum.com> References: <20091205192902.700bf752@cybert.demosophia.net> <4B1B3D9E.5070704@pressure.to> <20091206165012.37809f64@cybert.demosophia.net> <20091211220830.1592f1c7@cybert.demosophia.net> <8c02c9a4e2b8a30168e9d53d0ddb9e8f@ruby-forum.com> Message-ID: <4B858DD6.506@pressure.to> On 23/02/2010 15:27, Tony Meier wrote: >> It seems like 'set_table' in Grid makes a clone of the table, and >> thereby make it impossible to manipulate the table directly. >> > Can anyone confirm this is the way to go? > Yes, definitely. I looked at wxWidgets underlying C++ code for this a while back. It clones the C++ object, so it's likely the Ruby Grid class will continue to have this behaviour. a From alex at pressure.to Wed Feb 24 15:34:54 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 24 Feb 2010 20:34:54 +0000 Subject: [wxruby-users] How to make a Grid reread the number of rows in a Table? In-Reply-To: <8c02c9a4e2b8a30168e9d53d0ddb9e8f@ruby-forum.com> References: <20091205192902.700bf752@cybert.demosophia.net> <4B1B3D9E.5070704@pressure.to> <20091206165012.37809f64@cybert.demosophia.net> <20091211220830.1592f1c7@cybert.demosophia.net> <8c02c9a4e2b8a30168e9d53d0ddb9e8f@ruby-forum.com> Message-ID: <4B858D6E.6070506@pressure.to> On 23/02/2010 15:27, Tony Meier wrote: >> It seems like 'set_table' in Grid makes a clone of the table, and >> thereby make it impossible to manipulate the table directly. >> > Can anyone confirm this is the way to go? > Yes, definitely. I looked at wxWidgets underlying C++ code for this a while back. It clones the C++ object, so it's likely the Ruby Grid class will continue to have this behaviour. a From lists at ruby-forum.com Thu Feb 25 16:20:44 2010 From: lists at ruby-forum.com (Chris Williams) Date: Thu, 25 Feb 2010 22:20:44 +0100 Subject: [wxruby-users] Can't capture key events Message-ID: <2f84dba3ca79c8de9bbeafee301fc8c9@ruby-forum.com> In the following example code, there is no response to pressing any key. The mouse button does produce the desired result: require 'rubygems' require 'wx' class EventFrame < Wx::Frame def initialize() super(nil, -1, "Event Frame") panel = Wx::Panel.new(self) panel.evt_left_down {|event| puts "Left mouse key clicked"} panel.evt_key_down{|event| puts "Key clicked"} show() end end class MyApp < Wx::App def on_init EventFrame.new() end end MyApp.new.main_loop ... This is wxruby 2.0.1 on Ubuntu 9.10. I have also tried evt_key_up and evt_char. Any ideas? Thanks, Chris -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Feb 25 16:53:58 2010 From: lists at ruby-forum.com (Chris Williams) Date: Thu, 25 Feb 2010 22:53:58 +0100 Subject: [wxruby-users] Can't capture key events In-Reply-To: <2f84dba3ca79c8de9bbeafee301fc8c9@ruby-forum.com> References: <2f84dba3ca79c8de9bbeafee301fc8c9@ruby-forum.com> Message-ID: Chris Williams wrote: > In the following example code, there is no response to pressing any key. I found an answer. It works if I specifically give the panel focus (panel.set_focus). -- Posted via http://www.ruby-forum.com/. From gugui.sarubi.macchi at gmail.com Fri Feb 26 11:56:12 2010 From: gugui.sarubi.macchi at gmail.com (=?ISO-8859-1?Q?Gug=E3o?=) Date: Fri, 26 Feb 2010 13:56:12 -0300 Subject: [wxruby-users] Running... libwx_gtk2u_gl-2.8.so.0 Message-ID: <4B87FD2C.3060005@gmail.com> Hi all, i?m new at wxruby on Linux so when i run my first program: require 'rubygems' require 'wx' include Wx class MyFrame < Frame def initialize() super(nil, -1, 'Hi') end end ---- $ ruby oi.rb /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so: libwx_gtk2u_gl-2.8.so.0: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wxruby2.so (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from /usr/lib/ruby/gems/1.8/gems/wxruby-1.9.9-x86-linux/lib/wx.rb:12 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from oi.rb:2 How to fix it ? thanks any help From lists at ruby-forum.com Sat Feb 27 12:35:47 2010 From: lists at ruby-forum.com (Lui Kore) Date: Sat, 27 Feb 2010 18:35:47 +0100 Subject: [wxruby-users] UpdateUIEvent.set_mode doesn't work Message-ID: <3ac93573d62443dcdc50f8b89722029d@ruby-forum.com> irb(main):001:0> require 'wx' => true irb(main):002:0> include Wx => Object irb(main):003:0> UpdateUIEvent.set_mode 1 TypeError: Expected argument 0 of type wxUpdateUIMode, but got Fixnum 1 in SWIG method 'wxUpdateUIEvent::SetMode' from (irb):3:in `set_mode' from (irb):3 from D:/Ruby/ruby1.9.1-mingw/bin/irb:12:in `
' irb(main):004:0> UPDATE_UI_PROCESS_SPECIFIED NameError: uninitialized constant UPDATE_UI_PROCESS_SPECIFIED from (irb):4 from D:/Ruby/ruby1.9.1-mingw/bin/irb:12:in `
' -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Feb 27 13:47:49 2010 From: lists at ruby-forum.com (Joe Ennis) Date: Sat, 27 Feb 2010 19:47:49 +0100 Subject: [wxruby-users] static gem of wxruby 2.0.1 for OS X Snow Leopard In-Reply-To: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> References: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> Message-ID: Antti Hakala wrote: > Hello, > I have a static gem of wxruby 2.0.1 that works on OS X Snow Leopard, > if somebody is interested. > I've tried it only on my own comp. It's about 9MB. Sincerely, I would be in your debt if I could receive your wxRuby gem for Leopard at: jce888 AT gmail DOT com -- joe -- Posted via http://www.ruby-forum.com/.