From penguinroad at gmail.com Wed Apr 1 01:28:37 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Wed, 1 Apr 2009 12:28:37 +0700 Subject: [wxruby-users] mouse click event at grid In-Reply-To: <49D1B775.6010204@pressure.to> References: <26dadb3d0903302132g3e2e5844sa39468c845cbb8b8@mail.gmail.com> <49D1B775.6010204@pressure.to> Message-ID: <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> On Tue, Mar 31, 2009 at 1:25 PM, Alex Fenton wrote: > hendra kusuma wrote: > >> how do we create an mouse click event binding for a grid? >> I look over the docs and cannot find any clue about it. >> google did not help either. >> > > evt_grid_cell_left_click > > Documented here: http://docs.wxwidgets.org/stable/wx_wxgrid.html#wxgrid > > Sorry, this appears to be missing from wxRuby docs. If in doubt, it can be > worth searching the wxWidgets docs as a backup. Just prepend 'wx' to the > class name for searching (eg wxGrid). > > With any widget, you can also use the lower-level mouse event handlers, eg > grid.evt_left_up > > alex Thanks It works, with an unexpected behavior thought While I can catch the click event now, mouse click won't move the selection to clicked cell anyway to fix this? > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Wed Apr 1 06:36:55 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 01 Apr 2009 11:36:55 +0100 Subject: [wxruby-users] mouse click event at grid In-Reply-To: <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> References: <26dadb3d0903302132g3e2e5844sa39468c845cbb8b8@mail.gmail.com> <49D1B775.6010204@pressure.to> <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> Message-ID: <49D343C7.3020806@pressure.to> hendra kusuma wrote: > On Tue, Mar 31, 2009 at 1:25 PM, Alex Fenton > wrote: > > > With any widget, you can also use the lower-level mouse event > handlers, eg grid.evt_left_up > > > It works, with an unexpected behavior thought > While I can catch the click event now, > mouse click won't move the selection to clicked cell > anyway to fix this? If you trap an event like this, you must call "event.skip" in the event handler if you want normal processing of the event (eg moving the selection on a click) to proceed. a From erubin at valcom.com Wed Apr 1 10:37:21 2009 From: erubin at valcom.com (Eric Rubin) Date: Wed, 1 Apr 2009 10:37:21 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min' for# In-Reply-To: <1ce38ef40903311157i64634dd3mad0618645464908d@mail.gmail.com> Message-ID: DataMapper just (Mar 30) released 0.9.11, which fixes some problems with Ruby 1.9, especially in data validation. I haven't tried it yet, but I'm about to... http://rubyforge.org/projects/datamapper Eric Rubin -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Eric Will Sent: Tuesday, March 31, 2009 2:58 PM To: wxruby-users at rubyforge.org Subject: Re: [wxruby-users] Error: undefined method 'calc_min' for# Are you using DataMapper? I've tracked this as my issue. I don't know what's wrong exactly, but after using DM to pull out a large amount of data I get this. I think it's destroying the heap or something, somehow. It only happens in 1.9 for me. It's so odd. I'm going to have to fall back to just using the mysql module to pull the data itself, then use DM to objectify them when I need them. It's definitely DM, but I couldn't find a rhyme or reason to any of the problems. It changes every time, and sometimes works fine. It has something to do with GC as well, because when I fiddle with the GC settings it works a lot better, but ultimately crashes anyway. _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From penguinroad at gmail.com Wed Apr 1 23:15:39 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Thu, 2 Apr 2009 10:15:39 +0700 Subject: [wxruby-users] mouse click event at grid In-Reply-To: <49D343C7.3020806@pressure.to> References: <26dadb3d0903302132g3e2e5844sa39468c845cbb8b8@mail.gmail.com> <49D1B775.6010204@pressure.to> <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> <49D343C7.3020806@pressure.to> Message-ID: <26dadb3d0904012015o37e604e4y238cc0ac9fad4adf@mail.gmail.com> On Wed, Apr 1, 2009 at 5:36 PM, Alex Fenton wrote: > hendra kusuma wrote: > >> On Tue, Mar 31, 2009 at 1:25 PM, Alex Fenton > alex at pressure.to>> wrote: >> >> >> With any widget, you can also use the lower-level mouse event >> handlers, eg grid.evt_left_up >> >> > >> It works, with an unexpected behavior thought >> While I can catch the click event now, >> mouse click won't move the selection to clicked cell >> anyway to fix this? >> > > If you trap an event like this, you must call "event.skip" in the event > handler if you want normal processing of the event (eg moving the selection > on a click) to proceed. > you mean something looks like this? evt_grid_cell_left_click() { do_click() } def do_click() puts 'ok' event.skip end > > > a > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Wed Apr 1 23:18:16 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Thu, 2 Apr 2009 10:18:16 +0700 Subject: [wxruby-users] Grid In-Reply-To: <49D1B636.90005@pressure.to> References: <20E76E7A3375460E992201958EE3FF64@sebastien> <49D1B636.90005@pressure.to> Message-ID: <26dadb3d0904012018t6861c7b2wdb3aeead8a5d59f6@mail.gmail.com> 2009/3/31 Alex Fenton > Bonjour > > sebastien wrote: > >> Je voudrais savoir comment d?s?lectionn? le rectangle noir ce trouvant >> dans la premi?re colonne(rows 0, col 0) de l'exemple Grid? >> Y ? t'il une option comme "TE_READONLY" qui emp?che d'?crire dans les >> cases? >> > > [Sebastien wrote: I'd like to know how to deselect the black rectangle in > the first cell (row 0, column 0) of the grid example. Is there an option > similar to TE_READONLY which prevents editing?] > > On peut utiliser 'Grid#enable_editing(false)' pour emp?cher d'?crire, mais > ?a ne cache pas le rectangle noir. Ici: > > http://lists.wxwidgets.org/pipermail/wxpython-users/2003-March/017516.html > > on parle d'une m?thode de wxPython, 'Grid#SetCellPenHiglightWidth' qui, je > crois, fait exactement ce que tu veux. Malheureusement, cette m?thode > n'?tait pas document? par wxWidgets, et donc, n'est pas disponible en wxRuby > 2.0. > > [You can use Grid.enable_editing(false) to prevent editing, but that > doesn't hide the black rectangle. Here: > > http://lists.wxwidgets.org/pipermail/wxpython-users/2003-March/017516.html > > there is a reference to a wxPython method 'Grid#SetCellPenHighlightWidth', > which I think does exactly what you want. Unfortunately, this method wasn't > documented by wxWidgets and so isn't available in wxRuby 2.0]. > > alex > Oh, I see Sorry I'm just curious because I recently work with grid too Thank you for the explaination > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Wed Apr 1 23:31:42 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Thu, 2 Apr 2009 10:31:42 +0700 Subject: [wxruby-users] mouse click event at grid In-Reply-To: <26dadb3d0904012015o37e604e4y238cc0ac9fad4adf@mail.gmail.com> References: <26dadb3d0903302132g3e2e5844sa39468c845cbb8b8@mail.gmail.com> <49D1B775.6010204@pressure.to> <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> <49D343C7.3020806@pressure.to> <26dadb3d0904012015o37e604e4y238cc0ac9fad4adf@mail.gmail.com> Message-ID: <26dadb3d0904012031j22964d96m674d4509d5811863@mail.gmail.com> On Thu, Apr 2, 2009 at 10:15 AM, hendra kusuma wrote: > > > On Wed, Apr 1, 2009 at 5:36 PM, Alex Fenton wrote: > >> hendra kusuma wrote: >> >>> On Tue, Mar 31, 2009 at 1:25 PM, Alex Fenton >> alex at pressure.to>> wrote: >>> >>> >>> With any widget, you can also use the lower-level mouse event >>> handlers, eg grid.evt_left_up >>> >>> >> >>> It works, with an unexpected behavior thought >>> While I can catch the click event now, >>> mouse click won't move the selection to clicked cell >>> anyway to fix this? >>> >> >> If you trap an event like this, you must call "event.skip" in the event >> handler if you want normal processing of the event (eg moving the selection >> on a click) to proceed. >> > > you mean something looks like this? > evt_grid_cell_left_click() { do_click() } > > def do_click() > puts 'ok' > event.skip > end > Ups, Not working Can you give me suggestion on my problem? This is what I want to do I fill datagrid with all data from a table first column is boolean, an is set with set_col_format_bool (appear as checkbox) I set all other columns to readonly so when I click the first column, it will change the value (true or false) and update the table (the primary key is at 2nd column) current state I click cell on first column, move focus to clicked-cell click the cell again, cell change to textbox, I can change the value there expected behavior click cell on first column, and it toggle the value between checked and unchecked Thanks Hendra > > > >> >> >> a >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sycobuny at malkier.net Thu Apr 2 06:56:40 2009 From: sycobuny at malkier.net (Stephen Belcher) Date: Thu, 2 Apr 2009 06:56:40 -0400 Subject: [wxruby-users] mouse click event at grid In-Reply-To: <26dadb3d0904012031j22964d96m674d4509d5811863@mail.gmail.com> References: <26dadb3d0903302132g3e2e5844sa39468c845cbb8b8@mail.gmail.com> <49D1B775.6010204@pressure.to> <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> <49D343C7.3020806@pressure.to> <26dadb3d0904012015o37e604e4y238cc0ac9fad4adf@mail.gmail.com> <26dadb3d0904012031j22964d96m674d4509d5811863@mail.gmail.com> Message-ID: I believe there are a couple of problems. First, you haven't actually passed the GridEvent to your handler. Second, it seems you only want to call event.skip if event.get_col is 0 (I've never used a Grid, I'm assuming the cols and rows are 0-indexed); It sounds like you want normal event processing to stop if they simply check the checkbox in the first column, ie the cell doesn't get highlighted afterwards, and then normal event processing to continue on any other column. I think the code you want should probably look more like this: evt_grid_cell_left_click() { |e| do_click(e) } # pass GridEvent as e def do_click(event) # get the event passed earlier puts 'ok' event.skip unless event.get_col == 0 # do normal processing except on 1st col end Also, since evt_grid_cell_left_click doesn't take an id parameter, it seems you'll probably have to put that entire chunk of code inside of a class declaration for the Grid itself (either extending Grid or the variable referencing it). Otherwise wxRuby won't know what control you're trying to catch an event on. If there's some other way around that, someone please correct me. Hope this helps, --Steve 2009/4/1 hendra kusuma > > > On Thu, Apr 2, 2009 at 10:15 AM, hendra kusuma wrote: > >> >> >> On Wed, Apr 1, 2009 at 5:36 PM, Alex Fenton wrote: >> >>> hendra kusuma wrote: >>> >>>> On Tue, Mar 31, 2009 at 1:25 PM, Alex Fenton >>> alex at pressure.to>> wrote: >>>> >>>> >>>> With any widget, you can also use the lower-level mouse event >>>> handlers, eg grid.evt_left_up >>>> >>>> >>> >>>> It works, with an unexpected behavior thought >>>> While I can catch the click event now, >>>> mouse click won't move the selection to clicked cell >>>> anyway to fix this? >>>> >>> >>> If you trap an event like this, you must call "event.skip" in the event >>> handler if you want normal processing of the event (eg moving the selection >>> on a click) to proceed. >>> >> >> you mean something looks like this? >> evt_grid_cell_left_click() { do_click() } >> >> def do_click() >> puts 'ok' >> event.skip >> end >> > > Ups, Not working > > Can you give me suggestion on my problem? > This is what I want to do > > I fill datagrid with all data from a table > first column is boolean, an is set with set_col_format_bool (appear as > checkbox) > I set all other columns to readonly > so when I click the first column, it will change the value (true or false) > and update the table (the primary key is at 2nd column) > > current state > I click cell on first column, move focus to clicked-cell > click the cell again, cell change to textbox, I can change the value there > > expected behavior > click cell on first column, and it toggle the value between checked and > unchecked > > Thanks > Hendra > > > >> >> >> >>> >>> >>> a >>> _______________________________________________ >>> wxruby-users mailing list >>> wxruby-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/wxruby-users >>> >> >> > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rakaur at malkier.net Thu Apr 2 09:18:43 2009 From: rakaur at malkier.net (Eric Will) Date: Thu, 2 Apr 2009 09:18:43 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min' for# In-Reply-To: References: <1ce38ef40903311157i64634dd3mad0618645464908d@mail.gmail.com> Message-ID: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> On Wed, Apr 1, 2009 at 10:37 AM, Eric Rubin wrote: > DataMapper just (Mar 30) released 0.9.11, which fixes some problems with > Ruby 1.9, especially in data validation. ?I haven't tried it yet, but I'm > about to... > > http://rubyforge.org/projects/datamapper > > Eric Rubin I'll try the new version. I also have plans to mess with the controls in the window, then try it without having DM required at all, and I guess if I have to, rewrite the entire window. -- Eric Will From rakaur at malkier.net Thu Apr 2 09:21:11 2009 From: rakaur at malkier.net (Eric Will) Date: Thu, 2 Apr 2009 09:21:11 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min' for# In-Reply-To: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> References: <1ce38ef40903311157i64634dd3mad0618645464908d@mail.gmail.com> <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> Message-ID: <1ce38ef40904020621o61ab38c5ld469ac4e4fe7e16a@mail.gmail.com> On Thu, Apr 2, 2009 at 9:18 AM, Eric Will wrote: > I'll try the new version. I also have plans to mess with the controls > in the window, then try it without having DM required at all, and I > guess if I have to, rewrite the entire window. Yeah, that didn't work. Same thing happens on 1.9, and now 1.8 cores the interpreter. Superb. -- Eric Will From migui_man at hotmail.com Thu Apr 2 09:21:19 2009 From: migui_man at hotmail.com (=?iso-8859-1?Q?Miguel_Mu=F1oz_Aranc=F3n?=) Date: Thu, 2 Apr 2009 15:21:19 +0200 Subject: [wxruby-users] Help building wxRuby with VC8 Message-ID: Hello, I'm trying to build wxRuby-2.0.0 with Ruby 1.9.1-p0 and SWIG 1.3.39 using VC8, but so far I didn't manage to do it. First of all, is there some information available online for building wxRuby with Visual Studio? Up to now I've found three problems: one that I could solve, another that I could avoid and a third one that blocked me completely (Goldilocks and the Three Compiler Errors! - ok, no more jokes, I promise). I'd be grateful if anyone could help me with these problems. The first problem was with a wxWidgets include file, "wx/filefn.h". When compiling wxRuby, the following error was shown: error C2628: '_off_t' followed by '__int64' is ilegal I found online a solution for this, but I don't know if it's the correct one. See http://forum.videolan.org/viewtopic.php?f=2&t=792. In filefn.h, add the condition !defined(_OFF_T_DEFINED) before the definition of off_t. The modified code is: #if (!defined(_OFF_T_DEFINED) && defined(__VISUALC__) && !defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) ) typedef _off_t off_t; ... #endif The second problem was that the class wxGLCanvas was not defined when compiling wxRuby. I edited manually the GLCanvas.cpp file generated by SWIG and added "#define wxUSE_GLCANVAS 1". Could you tell me what is the correct place to set this option? And finally, the third problem is that when building wxRuby with Rake some classes cannot be found by fixmodule.rb. I get the following message: Class: AboutDialogInfo ERROR! swig/fixmodule.rb Didn't find swig class rake aborted! Command failed with status (1): [ruby swig/fixmodule.rb src/AboutDialogInfo...] I tried to modify fixmodule.rb and got everything to compile, but then the linking failed with many undefined references to extern symbols like cWxToplevelWindow. What am I doing wrong? I don't think it's related, but I'm using a version of Rake built with Ruby 1.8.6 and I'm trying to build wxRuby for Ruby 1.9.1. Thanks in advance for your help. Best regards, Miguel _________________________________________________________________ ?Quieres crear tus propios emoticonos gratis? Descubre c?mo hacerlo en el Club Oficial de Messenger http://vivelive.com/ilovemessenger/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rakaur at malkier.net Thu Apr 2 10:52:47 2009 From: rakaur at malkier.net (Eric Will) Date: Thu, 2 Apr 2009 10:52:47 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min' for# In-Reply-To: <1ce38ef40904020621o61ab38c5ld469ac4e4fe7e16a@mail.gmail.com> References: <1ce38ef40903311157i64634dd3mad0618645464908d@mail.gmail.com> <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> <1ce38ef40904020621o61ab38c5ld469ac4e4fe7e16a@mail.gmail.com> Message-ID: <1ce38ef40904020752j414b4c23p941fb1b3cb11ead8@mail.gmail.com> On Thu, Apr 2, 2009 at 9:21 AM, Eric Will wrote: > Yeah, that didn't work. Same thing happens on 1.9, and now 1.8 cores > the interpreter. Superb. It's now spontaneously started giving me a calc_min error on an older program that I haven't changed in ages. Was there a semi-recent wxRuby update? I can't think of any reason other than something wonky with Wx now. This older program doesn't use DM at all. > -- Eric Will From erubin at valcom.com Thu Apr 2 13:05:47 2009 From: erubin at valcom.com (Eric Rubin) Date: Thu, 2 Apr 2009 13:05:47 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min'for# In-Reply-To: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> Message-ID: <202E0CAB1B6D4F23B3C9F61A05D58989@valcom.com> Going to DataMapper 0.9.11 solved my problem with validation under Ruby 1.9 Eric Rubin -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Eric Will Sent: Thursday, April 02, 2009 9:19 AM To: General discussion of wxRuby Subject: Re: [wxruby-users] Error: undefined method 'calc_min'for# On Wed, Apr 1, 2009 at 10:37 AM, Eric Rubin wrote: > DataMapper just (Mar 30) released 0.9.11, which fixes some problems with > Ruby 1.9, especially in data validation. ?I haven't tried it yet, but I'm > about to... > > http://rubyforge.org/projects/datamapper > > Eric Rubin I'll try the new version. I also have plans to mess with the controls in the window, then try it without having DM required at all, and I guess if I have to, rewrite the entire window. -- Eric Will _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From rakaur at malkier.net Thu Apr 2 13:46:41 2009 From: rakaur at malkier.net (Eric Will) Date: Thu, 2 Apr 2009 13:46:41 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min'for# In-Reply-To: <202E0CAB1B6D4F23B3C9F61A05D58989@valcom.com> References: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> <202E0CAB1B6D4F23B3C9F61A05D58989@valcom.com> Message-ID: <1ce38ef40904021046s424b1339td224f296dfbf33b7@mail.gmail.com> On Thu, Apr 2, 2009 at 1:05 PM, Eric Rubin wrote: > Going to DataMapper 0.9.11 solved my problem with validation under Ruby 1.9 This didn't do anything for me. > Eric Rubin -- Eric Will From lists at ruby-forum.com Thu Apr 2 15:02:08 2009 From: lists at ruby-forum.com (Michael Satterwhite) Date: Thu, 2 Apr 2009 21:02:08 +0200 Subject: [wxruby-users] Controlling vertical position Message-ID: <25b9afcbb8f0a847b30e0ce40f499399@ruby-forum.com> First, I want to thank everyone here who's been helping me learn wxRuby. The biggest problem I'm having is getting the layout of a screen right. Right now, I have a dialog with several controls on it. With one exception, it looks good. I'm using wxFormBuilder and Xrcise to do the generation. I'm using nested box sizers to try to get things into the right positions. On the upper corner of the screen, I have a box sizer (HORIZONTAL) with a label and a text edit control. Horizontally, they are perfect. They are, however, at the top of the sizer, and I'd like to move them down a bit in the sizer. They don't have to be centered vertically, but they do need to move down some. I've tried everything I can think of, nesting other sizers in that sections, etc. but nothing seems to work correctly. Would someone be so kind as to give me some ideas ... or point me at some more tutorials on sizers and spacers. I've gone through all of them I can find on the documentation site. Thank you *VERY MUCH* ... in advance. ---Michael -- Posted via http://www.ruby-forum.com/. From rakaur at malkier.net Thu Apr 2 15:03:25 2009 From: rakaur at malkier.net (Eric Will) Date: Thu, 2 Apr 2009 15:03:25 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min'for# In-Reply-To: <1ce38ef40904021046s424b1339td224f296dfbf33b7@mail.gmail.com> References: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> <202E0CAB1B6D4F23B3C9F61A05D58989@valcom.com> <1ce38ef40904021046s424b1339td224f296dfbf33b7@mail.gmail.com> Message-ID: <1ce38ef40904021203s7ec46252i45b72d16b586ff97@mail.gmail.com> I tried downgrading to wxRuby 1.9.5, and now I get this: /home/rakaur/Dropbox/Sources/work/Palaeoptera/lib/Palaeoptera/ui/equipmentfinder.rb:195: [BUG] object allocation during garbage collection phase ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] Aborted Using 2.0.0 on 1.8: /home/rakaur/Dropbox/Sources/work/Palaeoptera/lib/Palaeoptera/ui/equipmentfinder.rb:31:in `calc_min': undefined method `calc_min' for "FacilityNumber":String (NoMethodError) [...] So, I don't know what exactly is going on, but I think it somehow relates to garbage collection. When I try turning it off and/or toying with it in other ways it crashes in different ways. I'm still not ultimately sure what's going on, but there's obviously some way wxRuby is involved. I don't even have to populate the ListCtrl with the data, simply pulling it from the DB manages to do the calc_min() crash. I don't get how wxRuby is even getting at this stuff. Does it do some sort of introspection/reflection? I'm simply asking the DB for the data, and iterating over it. Simply the act of iterating over it, even if I do nothing more than an empty loop, kills me. I'm going nuts, here. -- Eric From penguinroad at gmail.com Thu Apr 2 22:05:50 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Fri, 3 Apr 2009 09:05:50 +0700 Subject: [wxruby-users] mouse click event at grid In-Reply-To: References: <26dadb3d0903302132g3e2e5844sa39468c845cbb8b8@mail.gmail.com> <49D1B775.6010204@pressure.to> <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> <49D343C7.3020806@pressure.to> <26dadb3d0904012015o37e604e4y238cc0ac9fad4adf@mail.gmail.com> <26dadb3d0904012031j22964d96m674d4509d5811863@mail.gmail.com> Message-ID: <26dadb3d0904021905r5766080cpc3d6651a07feefec@mail.gmail.com> 2009/4/2 Stephen Belcher > I believe there are a couple of problems. First, you haven't actually > passed the GridEvent to your handler. Second, it seems you only want to > call event.skip if event.get_col is 0 (I've never used a Grid, I'm assuming > the cols and rows are 0-indexed); It sounds like you want normal event > processing to stop if they simply check the checkbox in the first column, ie > the cell doesn't get highlighted afterwards, and then normal event > processing to continue on any other column. I think the code you want > should probably look more like this: > > evt_grid_cell_left_click() { |e| do_click(e) } # pass GridEvent as e > > def do_click(event) # get the event passed earlier > puts 'ok' > event.skip unless event.get_col == 0 # do normal processing except on 1st > col > end > > Also, since evt_grid_cell_left_click doesn't take an id parameter, it seems > you'll probably have to put that entire chunk of code inside of a class > declaration for the Grid itself (either extending Grid or the variable > referencing it). Otherwise wxRuby won't know what control you're trying to > catch an event on. If there's some other way around that, someone please > correct me. > > Hope this helps, > --Steve Thank you This almost help me Yes, I can catch the click on 1st column now, but the another problem arise the pointer does not move to the clicked cell This is what in my mind, when the 1st column is clicked def clicked(event) if event.get_col == 0 pk = @grid.get_cell_value(@grid.get_grid_cursor_row,1) val = @grid.get_cell_value(@grid.get_grid_cursor_row,0) if val == '1' sql = "update table set val =0 where pk = #{pk}" @grid.set_cell_value(@grid.get_grid_cursor_row,0, '0') else sql = "update table set val =1 where pk = #{pk}" @grid.set_cell_value(@grid.get_grid_cursor_row,0, '1') end @conn.execute(sql) else event.skip end end but @grid.get_grid_cursor_row will return previous row, not clicked row What to do now? also, I cannot find the syntax event.get_col in documentation can you point me to the doc page? It would be very helpful Many Thanks Hendra > > 2009/4/1 hendra kusuma > > >> >> On Thu, Apr 2, 2009 at 10:15 AM, hendra kusuma wrote: >> >>> >>> >>> On Wed, Apr 1, 2009 at 5:36 PM, Alex Fenton wrote: >>> >>>> hendra kusuma wrote: >>>> >>>>> On Tue, Mar 31, 2009 at 1:25 PM, Alex Fenton >>>> alex at pressure.to>> wrote: >>>>> >>>>> >>>>> With any widget, you can also use the lower-level mouse event >>>>> handlers, eg grid.evt_left_up >>>>> >>>>> >>>> >>>>> It works, with an unexpected behavior thought >>>>> While I can catch the click event now, >>>>> mouse click won't move the selection to clicked cell >>>>> anyway to fix this? >>>>> >>>> >>>> If you trap an event like this, you must call "event.skip" in the event >>>> handler if you want normal processing of the event (eg moving the selection >>>> on a click) to proceed. >>>> >>> >>> you mean something looks like this? >>> evt_grid_cell_left_click() { do_click() } >>> >>> def do_click() >>> puts 'ok' >>> event.skip >>> end >>> >> >> Ups, Not working >> >> Can you give me suggestion on my problem? >> This is what I want to do >> >> I fill datagrid with all data from a table >> first column is boolean, an is set with set_col_format_bool (appear as >> checkbox) >> I set all other columns to readonly >> so when I click the first column, it will change the value (true or false) >> and update the table (the primary key is at 2nd column) >> >> current state >> I click cell on first column, move focus to clicked-cell >> click the cell again, cell change to textbox, I can change the value there >> >> expected behavior >> click cell on first column, and it toggle the value between checked and >> unchecked >> >> Thanks >> Hendra >> >> >> >>> >>> >>> >>>> >>>> >>>> a >>>> _______________________________________________ >>>> wxruby-users mailing list >>>> wxruby-users at rubyforge.org >>>> http://rubyforge.org/mailman/listinfo/wxruby-users >>>> >>> >>> >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Thu Apr 2 22:11:31 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Fri, 3 Apr 2009 09:11:31 +0700 Subject: [wxruby-users] tab Message-ID: <26dadb3d0904021911sb0aa9bbua80af1fa011611f7@mail.gmail.com> Hi there How to make tab button move the focus to next widget? Thanks Hendra -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Thu Apr 2 23:03:15 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Fri, 3 Apr 2009 10:03:15 +0700 Subject: [wxruby-users] mouse click event at grid In-Reply-To: <26dadb3d0904021905r5766080cpc3d6651a07feefec@mail.gmail.com> References: <26dadb3d0903302132g3e2e5844sa39468c845cbb8b8@mail.gmail.com> <49D1B775.6010204@pressure.to> <26dadb3d0903312228s1dc8cc49ue252c9622a040c4c@mail.gmail.com> <49D343C7.3020806@pressure.to> <26dadb3d0904012015o37e604e4y238cc0ac9fad4adf@mail.gmail.com> <26dadb3d0904012031j22964d96m674d4509d5811863@mail.gmail.com> <26dadb3d0904021905r5766080cpc3d6651a07feefec@mail.gmail.com> Message-ID: <26dadb3d0904022003i29c6762l5e5229f0cff54218@mail.gmail.com> On Fri, Apr 3, 2009 at 9:05 AM, hendra kusuma wrote: > > > 2009/4/2 Stephen Belcher > >> I believe there are a couple of problems. First, you haven't actually >> passed the GridEvent to your handler. Second, it seems you only want to >> call event.skip if event.get_col is 0 (I've never used a Grid, I'm assuming >> the cols and rows are 0-indexed); It sounds like you want normal event >> processing to stop if they simply check the checkbox in the first column, ie >> the cell doesn't get highlighted afterwards, and then normal event >> processing to continue on any other column. I think the code you want >> should probably look more like this: >> >> evt_grid_cell_left_click() { |e| do_click(e) } # pass GridEvent as e >> >> def do_click(event) # get the event passed earlier >> puts 'ok' >> event.skip unless event.get_col == 0 # do normal processing except on >> 1st col >> end >> >> Also, since evt_grid_cell_left_click doesn't take an id parameter, it >> seems you'll probably have to put that entire chunk of code inside of a >> class declaration for the Grid itself (either extending Grid or the variable >> referencing it). Otherwise wxRuby won't know what control you're trying to >> catch an event on. If there's some other way around that, someone please >> correct me. >> >> Hope this helps, >> --Steve > > > Thank you > This almost help me > Yes, I can catch the click on 1st column now, but the another problem arise > the pointer does not move to the clicked cell > This is what in my mind, when the 1st column is clicked > > def clicked(event) > if event.get_col == 0 > pk = @grid.get_cell_value(@grid.get_grid_cursor_row,1) > val = @grid.get_cell_value(@grid.get_grid_cursor_row,0) > if val == '1' > sql = "update table set val =0 where pk = #{pk}" > @grid.set_cell_value(@grid.get_grid_cursor_row,0, '0') > else > sql = "update table set val =1 where pk = #{pk}" > @grid.set_cell_value(@grid.get_grid_cursor_row,0, '1') > end > @conn.execute(sql) > else > event.skip > end > end > > but @grid.get_grid_cursor_row > will return previous row, not clicked row > > What to do now? > also, > I cannot find the syntax event.get_col in documentation > can you point me to the doc page? It would be very helpful > > Many Thanks > Hendra > I did it I found the doc page (Wx::GridEvent), figure out how to use event object and finally did it Now my grid work just the way I want it the final source code looks like this def clicked(event) if event.get_col == 0 row = event.get_row @grid.set_grid_cursor(row, 0) pk = @grid.get_cell_value(row,1) val = @grid.get_cell_value(row,0) if val == '0' @dataset.filter(:no => pk).update(:print => 1) @grid.set_cell_value(row,0,'1') else @dataset.filter(:no => pk).update(:print => 0) @grid.set_cell_value(row,0,'0') end else event.skip end end Many thanks for all your help Regards Hendra -------------- next part -------------- An HTML attachment was scrubbed... URL: From shs at demosophia.net Fri Apr 3 08:16:10 2009 From: shs at demosophia.net (Svend Haugaard =?iso-8859-1?Q?S=F8rensen?=) Date: Fri, 3 Apr 2009 14:16:10 +0200 (CEST) Subject: [wxruby-users] parallel lines in a ScrolledWindow Message-ID: <5fa37ad5d759796f4a4ac2bba405cea2.squirrel@webmail.demosophia.net> Hey. I am trying to figure out how access all the client area in an evt_paint in a scrolled window. I have made a little demo program, where I try to draw 2 parallel lines, and when scrolling the lines, they should stay parallel and the distance between them should increse. But since only the 'new' area gets redrawen the lines don't become parallel. How can I fix it so that they becomes parallel? -------------- next part -------------- A non-text attachment was scrubbed... Name: ScrolledLines.rb Type: application/octet-stream Size: 1759 bytes Desc: not available URL: From lists at ruby-forum.com Fri Apr 3 13:14:22 2009 From: lists at ruby-forum.com (Michael Satterwhite) Date: Fri, 3 Apr 2009 19:14:22 +0200 Subject: [wxruby-users] Problem with spacing Message-ID: <8f909a747b576b5b12ba7ab177215432@ruby-forum.com> I'm having the devil's time trying to get things laid out correctly. I've attached a screenshot so that you can get an idea of what I'm seeing. I've got a very unattractive space under the two combo boxes, and another one under the buttons. I don't understand how to reduce this. I know it's impossible to guess what idiocy I might have created. Therefore, (even though I don't like doing this) the .xrc file for this screen follows. I want to thank everyone willing to look at this and help teach this beginner with wxRuby. Here it is: 574,336 Contact Management wxVERTICAL 5 wxHORIZONTAL wxALL 5 wxALL 5 Select Group wxEXPAND 5 40,0 wxALL 5 wxRIGHT 15 wxEXPAND 5 6 2 0 0 wxALL 5 wxALL 5 200,-1 0 wxALL 5 wxALL 5 125,-1 0 wxALL 5 wxALL 5 200,-1 0 wxALL 5 wxALL 5 200,100 0 wxEXPAND 5 wxHORIZONTAL wxALL 5 0 wxALL 5 0 wxALL 5 0 wxALL 5 0 wxALL 5 0 Attachments: http://www.ruby-forum.com/attachment/3547/screenshot.jpg -- Posted via http://www.ruby-forum.com/. From chauk.mean at gmail.com Sat Apr 4 02:48:17 2009 From: chauk.mean at gmail.com (Chauk-Mean Proum) Date: Sat, 4 Apr 2009 08:48:17 +0200 Subject: [wxruby-users] Help building wxRuby with VC8 In-Reply-To: References: Message-ID: Hi, 2009/4/2 Miguel Mu?oz Aranc?n : > Hello, > > I'm trying to build wxRuby-2.0.0 with Ruby 1.9.1-p0 and SWIG 1.3.39 using > VC8, but so far I didn't manage to do it. First of all, is there some > information available online for building wxRuby with Visual Studio? Your configuration is not (yet?) supported. Currently on Windows : - wxRuby-2.0 with ruby-1.8 can be built without any problems with VC6 and VC7.1 - wxRuby-2.0 with ruby-1.9 cannot be built with any version of VC - wxRuby-2.0 with ruby-1.8 or ruby-1.9 can be built with MinGW The wxRuby team currently favors MinGW build for Windows. > The first problem was with a wxWidgets include file, "wx/filefn.h". When > compiling wxRuby, the following error was shown: > > error C2628: '_off_t' followed by '__int64' is ilegal > > I found online a solution for this, but I don't know if it's the correct > one. See http://forum.videolan.org/viewtopic.php?f=2&t=792. In filefn.h, add > the condition !defined(_OFF_T_DEFINED) before the definition of off_t. The > modified code is: > > #if (!defined(_OFF_T_DEFINED) && defined(__VISUALC__) && > !defined(__WXWINCE__)) || ( defined(__MWERKS__) && defined( __INTEL__) ) > ??? typedef _off_t off_t; > ... > #endif > I'll try that. > The second problem was that the class wxGLCanvas was not defined when > compiling wxRuby. I edited manually the GLCanvas.cpp file generated by SWIG > and added "#define wxUSE_GLCANVAS 1". Could you tell me what is the correct > place to set this option? It seems that you have not built wxWidgets appropriately. See http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets for build instructions of wxWidgets. Cheers. Chauk-Mean. From mario at ruby-im.net Sun Apr 5 04:21:52 2009 From: mario at ruby-im.net (Mario Steele) Date: Sun, 5 Apr 2009 03:21:52 -0500 Subject: [wxruby-users] Controlling vertical position In-Reply-To: <25b9afcbb8f0a847b30e0ce40f499399@ruby-forum.com> References: <25b9afcbb8f0a847b30e0ce40f499399@ruby-forum.com> Message-ID: There are two ways in which to do this in wxFormBuilder. A.) You can define the Border width, which is in Pixels, or you can use a Spacer, remove the wxEXPAND from it, set the proportion to 0, and define the height you want in pixels for the spacer to expand, there by moving the item(s) down from the top of the frame. hth, Mario P.S. Sorry for the delay in the response, been busy building up a Gentoo System here. On Thu, Apr 2, 2009 at 2:02 PM, Michael Satterwhite wrote: > First, I want to thank everyone here who's been helping me learn wxRuby. > > The biggest problem I'm having is getting the layout of a screen right. > > Right now, I have a dialog with several controls on it. With one > exception, it looks good. I'm using wxFormBuilder and Xrcise to do the > generation. I'm using nested box sizers to try to get things into the > right positions. > > On the upper corner of the screen, I have a box sizer (HORIZONTAL) with > a label and a text edit control. Horizontally, they are perfect. They > are, however, at the top of the sizer, and I'd like to move them down a > bit in the sizer. They don't have to be centered vertically, but they do > need to move down some. I've tried everything I can think of, nesting > other sizers in that sections, etc. but nothing seems to work correctly. > > Would someone be so kind as to give me some ideas ... or point me at > some more tutorials on sizers and spacers. I've gone through all of them > I can find on the documentation site. > > Thank you *VERY MUCH* ... in advance. > ---Michael > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Sun Apr 5 04:27:53 2009 From: mario at ruby-im.net (Mario Steele) Date: Sun, 5 Apr 2009 03:27:53 -0500 Subject: [wxruby-users] Error: undefined method 'calc_min'for# In-Reply-To: <1ce38ef40904021203s7ec46252i45b72d16b586ff97@mail.gmail.com> References: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> <202E0CAB1B6D4F23B3C9F61A05D58989@valcom.com> <1ce38ef40904021046s424b1339td224f296dfbf33b7@mail.gmail.com> <1ce38ef40904021203s7ec46252i45b72d16b586ff97@mail.gmail.com> Message-ID: Firstly, wxRuby 1.9.5 was built specifically for Ruby 1.8.6 p100ish, around that area, so with 1.8.7 p72, there are some major changes to the way memory is handled, and there by, it may be difficult to use older version of wxRuby with newer versionf of the Ruby interpreter. Secondly, It is a Memory allocation issue. More specifically, somehow wxRuby and Ruby are getting their objects mixed up. Every object that you create with wxRuby, is stored internally in the wxRuby library itself, in an Array if you would. This way, we can keep track of the instances of objects, when there is re-direction. By Re-directions, I mean when we need to get the control specifically, for an event that occured, we need to store this information somewhere, where we can look it up. Now cause of this, somehow, wxRuby, or specifically wxWidgets is sending an instance of a control, that it knows to be valid, however, the event handler for calc_size(), which is part of Layout, that wxRuby attempts to parse, can't find the reference properly, and is returning some other Ruby object that it thinks it matched correctly. Therefore, we need to investigate specifically on the C++ Layer, and on the SWIG Layer, why we are getting invalid objects when it comes to Layout#calc_min. Trust me, it's extreemly hard to debug something like this. And to track down the source. It could actually be something that has nothing to do with the Memory tracking that we are doing, and in some other off-hand code that we are using to create objects. Simply put, we don't know, but we are researching the problem. Please be patient with us. thanks, Mario On Thu, Apr 2, 2009 at 2:03 PM, Eric Will wrote: > I tried downgrading to wxRuby 1.9.5, and now I get this: > > > /home/rakaur/Dropbox/Sources/work/Palaeoptera/lib/Palaeoptera/ui/equipmentfinder.rb:195: > [BUG] object allocation during garbage collection phase > ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] > > Aborted > > Using 2.0.0 on 1.8: > > > /home/rakaur/Dropbox/Sources/work/Palaeoptera/lib/Palaeoptera/ui/equipmentfinder.rb:31:in > `calc_min': undefined method `calc_min' for "FacilityNumber":String > (NoMethodError) > > [...] > > So, I don't know what exactly is going on, but I think it somehow > relates to garbage collection. When I try turning it off and/or toying > with it in other ways it crashes in different ways. I'm still not > ultimately sure what's going on, but there's obviously some way wxRuby > is involved. > > I don't even have to populate the ListCtrl with the data, simply > pulling it from the DB manages to do the calc_min() crash. I don't get > how wxRuby is even getting at this stuff. Does it do some sort of > introspection/reflection? I'm simply asking the DB for the data, and > iterating over it. Simply the act of iterating over it, even if I do > nothing more than an empty loop, kills me. > > I'm going nuts, here. > > -- Eric > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Sun Apr 5 04:34:03 2009 From: mario at ruby-im.net (Mario Steele) Date: Sun, 5 Apr 2009 03:34:03 -0500 Subject: [wxruby-users] tab In-Reply-To: <26dadb3d0904021911sb0aa9bbua80af1fa011611f7@mail.gmail.com> References: <26dadb3d0904021911sb0aa9bbua80af1fa011611f7@mail.gmail.com> Message-ID: Hello Hendra, Unless your attempting to intercept the TAB Key event, it should all be internally handled by both wxWidgets, and the actual GUI Kit that wxWidgets utilizes to create the contols on the specific Operating System. Some controls, such as a TextCtrl, with TE_MULTILINE, will eat the TAB key event, in which case, you need to monitor the Key events on that specific control, to intercept the tab key, and decide how you want to handle it. Review the documentation on KeyEvent, to see a few details on it, and take a look at the example for Caret, as it intercepts key events to do the drawing handling on the Panel. hth Mario 2009/4/2 hendra kusuma > Hi there > > How to make tab button move the focus to next widget? > > Thanks > Hendra > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Sun Apr 5 04:39:17 2009 From: mario at ruby-im.net (Mario Steele) Date: Sun, 5 Apr 2009 03:39:17 -0500 Subject: [wxruby-users] parallel lines in a ScrolledWindow In-Reply-To: <5fa37ad5d759796f4a4ac2bba405cea2.squirrel@webmail.demosophia.net> References: <5fa37ad5d759796f4a4ac2bba405cea2.squirrel@webmail.demosophia.net> Message-ID: Hello Svend, You may want to take a look at the wxScrolledWindow code in BigDemo.rb, in the samples directory. You should be able to find code in there, that offers references points in the client area, where to keep track of where the user draws lines, and you can start to scroll through things. You should be able to see in the code, where the drawing of the user input with the mouse (MouseEvent), to see where it grabs the client position, and normalizes it to where you are in the actual view of the client view, compared to the Canvas. hth, Mario 2009/4/3 Svend Haugaard S?rensen > Hey. > > I am trying to figure out how access all the > client area in an evt_paint in a scrolled window. > > I have made a little demo program, where I try > to draw 2 parallel lines, and when scrolling > the lines, they should stay parallel and the > distance between them should increse. > > But since only the 'new' area gets redrawen > the lines don't become parallel. > > How can I fix it so that they becomes parallel? > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Sun Apr 5 04:53:41 2009 From: mario at ruby-im.net (Mario Steele) Date: Sun, 5 Apr 2009 03:53:41 -0500 Subject: [wxruby-users] Problem with spacing In-Reply-To: <8f909a747b576b5b12ba7ab177215432@ruby-forum.com> References: <8f909a747b576b5b12ba7ab177215432@ruby-forum.com> Message-ID: Hello Michael, I went directly to your screenshot, and realized what the problem was without even looking at your message. Then I went and read your message. ;-) Anyways, the problem, is that your xrc has the problem, of telling your wxHORIZONTAL box, to have a proportion of 1, which is what you get , cause it's taking up an even space between the three actual sizers you have in your XRC Code. The specific line in the XRC is here: > > wxVERTICAL > > * > * > 5 > > wxHORIZONTAL > > > wxALL > 5 > > > > You need to change that to Which handles the Proportion of your Horizontal box sizer. Once you do that, you should get the correct layout. If your using wxFormBuilder, you can find this in the properties of the wxHorizontal sizer, under the heading of sizeritem. hth, Mario -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From shs at demosophia.net Sun Apr 5 08:11:55 2009 From: shs at demosophia.net (Svend Haugaard =?iso-8859-1?Q?S=F8rensen?=) Date: Sun, 5 Apr 2009 14:11:55 +0200 (CEST) Subject: [wxruby-users] parallel lines in a ScrolledWindow In-Reply-To: References: <5fa37ad5d759796f4a4ac2bba405cea2.squirrel@webmail.demosophia.net> Message-ID: > Hello Svend, > > You may want to take a look at the wxScrolledWindow code in BigDemo.rb, in > the samples directory. You should be able to find code in there, that > offers references points in the client area, where to keep track of where > the user draws lines, and you can start to scroll through things. > > You should be able to see in the code, where the drawing of the user input > with the mouse (MouseEvent), to see where it grabs the client position, > and > normalizes it to where you are in the actual view of the client view, > compared to the Canvas. > Thank your for the reply, unfortunately your have totally misunderstood the question. Simple conversation of user input coordinates to window coordinates I have solve long ago. Try to run my program and your and your will see that the parallel lines gets tilted when your scrool the window. I am tying to update the hole client area at once. > hth, > > Mario > > 2009/4/3 Svend Haugaard S?rensen > >> Hey. >> >> I am trying to figure out how access all the >> client area in an evt_paint in a scrolled window. >> >> I have made a little demo program, where I try >> to draw 2 parallel lines, and when scrolling >> the lines, they should stay parallel and the >> distance between them should increse. >> >> But since only the 'new' area gets redrawen >> the lines don't become parallel. >> >> How can I fix it so that they becomes parallel? >> >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > > > -- > Mario Steele > http://www.trilake.net > http://www.ruby-im.net > http://rubyforge.org/projects/wxruby/ > http://rubyforge.org/projects/wxride/ > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From lists at ruby-forum.com Sun Apr 5 11:12:34 2009 From: lists at ruby-forum.com (Michael Satterwhite) Date: Sun, 5 Apr 2009 17:12:34 +0200 Subject: [wxruby-users] Problem with spacing - Thank You, Mario In-Reply-To: References: <8f909a747b576b5b12ba7ab177215432@ruby-forum.com> Message-ID: <311eab7f4c0a495a433bfa02c8c21e8d@ruby-forum.com> Mario Steele wrote: > Hello Michael, > > I went directly to your screenshot, and realized what the problem was > without even looking at your message. Then I went and read your > message. > ;-) Thank you *VERY* much. I'm still trying to get the various options regarding spacers and sizers into my head. I really appreciate you helping me here. ---Michael -- Posted via http://www.ruby-forum.com/. From aldric at trevoke.net Sun Apr 5 13:57:10 2009 From: aldric at trevoke.net (Aldric Giacomoni) Date: Sun, 05 Apr 2009 13:57:10 -0400 Subject: [wxruby-users] Creating a ... table/matrix/grid ? Message-ID: <49D8F0F6.5000709@trevoke.net> Hey guys. First post, and I have a project which is ambitious (to me anyway, since this is my first foray ever in GUI). I want to dynamically create (from 2 arrays for instance) a table with rows and columns, and each 'cell' would behave like a checkbox, sending a query to a database tailored after the row/column in which it is (a very simple query). I've successfully done the same purpose with nested loops in a text-only Ruby environment. The same purpose could be obtained from, say, two drop-down menus selecting the options and pressing a button - but I want a quick, graphical way of doing it all (maybe check all the boxes then use a submit button, that'd work too).. Now that I've explained all that.. I am a complete newbie at wxruby. I followed the first three or so tutorials but I don't really know where to go from there. Does anyone have a theoretical explanation of how to accomplish what I want to do.. And maybe intermediary projects I can accomplish to get there? Sorry if I'm rambling a little.. Thanks in advance :) --Aldric From rakaur at malkier.net Sun Apr 5 15:18:50 2009 From: rakaur at malkier.net (Eric Will) Date: Sun, 5 Apr 2009 15:18:50 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min'for# In-Reply-To: References: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> <202E0CAB1B6D4F23B3C9F61A05D58989@valcom.com> <1ce38ef40904021046s424b1339td224f296dfbf33b7@mail.gmail.com> <1ce38ef40904021203s7ec46252i45b72d16b586ff97@mail.gmail.com> Message-ID: <1ce38ef40904051218r6f3804dfjcdc764b81f4c5d95@mail.gmail.com> On Sun, Apr 5, 2009 at 4:27 AM, Mario Steele wrote: > Trust me, it's extreemly hard to debug something like this.? And to track > down the source.? It could actually be something that has nothing to do with > the Memory tracking that we are doing, and in some other off-hand code that > we are using to create objects.? Simply put, we don't know, but we are > researching the problem. > > Please be patient with us. Trust me, I know. I used to code in straight C, and I would get difficult problems like this from time to time. I appreciate that you are looking into it. If it helps, it seems to happen less often on 1.8. Sometimes it works fine, sometimes it gives me the calc_min() error. It ALWAYS gives me the calc_min() on 1.9. > > thanks, > > Mario -- Eric Will From alex at pressure.to Sun Apr 5 16:36:39 2009 From: alex at pressure.to (Alex Fenton) Date: Sun, 05 Apr 2009 21:36:39 +0100 Subject: [wxruby-users] Creating a ... table/matrix/grid ? In-Reply-To: <49D8F0F6.5000709@trevoke.net> References: <49D8F0F6.5000709@trevoke.net> Message-ID: <49D91657.5060205@pressure.to> Hi Aldric Aldric Giacomoni wrote: > Hey guys. First post, and I have a project which is ambitious (to me > anyway, since this is my first foray ever in GUI). > I want to dynamically create (from 2 arrays for instance) a table with > rows and columns, and each 'cell' would behave like a checkbox, sending > a query to a database tailored after the row/column in which it is (a > very simple query). Welcome to wxRuby which, happily, has a widget that I think will be very well suited to your project. It's called Wx::Grid, and the documentation is here: http://wxruby.rubyforge.org/doc/grid.html Note that there is one missing section we recently noticed in this doc, which describes some of the events generated by grid. Have a look also at: http://docs.wxwidgets.org/stable/wx_wxgrid.html There are two quite comprehensive grid samples that came with your wxruby installation, in /samples/grid/. You could study these as an intermediary project. Briefly, on some of the things you want to do: - to display cells with check-box like appearance, use Wx::GridCellBoolRenderer and Wx::GridCellBoolEditor classes. If you find you don't like the default way these work, you can also completely customise how cells are displayed using your own subclass of Wx::GridCellRenderer. - to handle an action when a cell is checked or unchecked, set up an event handler on evt_grid_cell_change. - if you already have the code that interacts with the database, an efficient way to link this to the GUI display can be to use GridTableBase. I won't go into detail, but have a look at the sample - if you're used to model/view separation this works nicely. hth alex From alex at pressure.to Sun Apr 5 17:01:17 2009 From: alex at pressure.to (Alex Fenton) Date: Sun, 05 Apr 2009 22:01:17 +0100 Subject: [wxruby-users] parallel lines in a ScrolledWindow In-Reply-To: <5fa37ad5d759796f4a4ac2bba405cea2.squirrel@webmail.demosophia.net> References: <5fa37ad5d759796f4a4ac2bba405cea2.squirrel@webmail.demosophia.net> Message-ID: <49D91C1D.7060208@pressure.to> Svend Haugaard S?rensen wrote: > Hey. > > I am trying to figure out how access all the > client area in an evt_paint in a scrolled window. > > I have made a little demo program, where I try > to draw 2 parallel lines, and when scrolling > the lines, they should stay parallel and the > distance between them should increse. > > But since only the 'new' area gets redrawen > the lines don't become parallel. > > How can I fix it so that they becomes parallel? I think you want something like (untested) evt_scroll { refresh } Calling refresh() tells wxRuby that the whole window is invalidated and needs to be redrawn, not just the parts of the window that have newly been scrolled into view. By the way, it's useful to mention what OS you're using. For example, I don't see what you describe when I run your program on OS X- it works the way I think you want it to work - probably because different OSes handle drawing and buffering slightly differently. alex From rakaur at malkier.net Mon Apr 6 12:42:52 2009 From: rakaur at malkier.net (Eric Will) Date: Mon, 6 Apr 2009 12:42:52 -0400 Subject: [wxruby-users] Error: undefined method 'calc_min'for# In-Reply-To: <1ce38ef40904051218r6f3804dfjcdc764b81f4c5d95@mail.gmail.com> References: <1ce38ef40904020618k11afe2a1rb9334816223fc96f@mail.gmail.com> <202E0CAB1B6D4F23B3C9F61A05D58989@valcom.com> <1ce38ef40904021046s424b1339td224f296dfbf33b7@mail.gmail.com> <1ce38ef40904021203s7ec46252i45b72d16b586ff97@mail.gmail.com> <1ce38ef40904051218r6f3804dfjcdc764b81f4c5d95@mail.gmail.com> Message-ID: <1ce38ef40904060942y623a398ak2753cdfbd2a94fa5@mail.gmail.com> This is happening in my EquipmentFinderWindow which is a Wx::Frame. I realize that this doesn't fix anything, but it "hides" the problem and the window works normally afterward: begin show rescue NoMethodError => e raise unless e =~ /calc_min/ EquipmentFinderWindow.new end I realize it's not a real fix, and it's only probably messing stuff up more, but it works, for now... -- Eric Will From migui_man at hotmail.com Tue Apr 7 09:00:26 2009 From: migui_man at hotmail.com (=?iso-8859-1?Q?Miguel_Mu=F1oz_Aranc=F3n?=) Date: Tue, 7 Apr 2009 15:00:26 +0200 Subject: [wxruby-users] Help building wxRuby with VC8 In-Reply-To: References: Message-ID: > From: Chauk-Mean Proum Thanks for your answer. > > I'm trying to build wxRuby-2.0.0 with Ruby 1.9.1-p0 and SWIG 1.3.39 using > > VC8, but so far I didn't manage to do it. First of all, is there some > > information available online for building wxRuby with Visual Studio? > > Your configuration is not (yet?) supported. I was afraid of this. Unfortunately I cannot change to MinGW because I need to interface with a C++ application that I cannot port. I know that this is not the list to discuss it, but I miss in Ruby something like Tcl's stubs: the interpreter exposes its API through a table of function pointers so that binary extensions are compatible across different versions of the interpreter. This would be very useful for a project like wxRuby. > > The second problem was that the class wxGLCanvas was not defined when > > compiling wxRuby. I edited manually the GLCanvas.cpp file generated by SWIG > > and added "#define wxUSE_GLCANVAS 1". Could you tell me what is the correct > > place to set this option? > > It seems that you have not built wxWidgets appropriately. > See http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets for > build instructions of wxWidgets. Aha! I hadn't see this page. This fixes the wxGLCanvas problem. > > Class: AboutDialogInfo > > ERROR! swig/fixmodule.rb Didn't find swig class Regarding the third problem, it seems that fixmodule.rb looks for some declarations of swig_class variables that don't exist. It seems that they are not generated at all by SWIG, so there could be some problem before VC8 does anything. Which exact version of SWIG is proven to work with wxRuby? (The build instructions say only "any recent version"). In case that it's useful to diagnose my problem, I'll add some more information. I got wxRuby 2.0.0 to build against Ruby 1.8.7 with the following modifications: - remove the call to fixmodule.rb in rake/rakewx.rb; this script looks for declarations like "swig_class cXXXXX" that are not extern, but there are no such declarations in my SWIG generated code. - add some variable declarations in swig/wx.i: swig_class cWxWindow; swig_class cWxTopLevelWindow; swig_class cWxSize; swig_class cWxEvent; swig_class cWxEvtHandler; I installed wxRuby and set the executable manifest as explained in the wiki, but when I run "require 'Wx'" the interpreter crashes with an unhandled exception, so obviously that's not the correct solution. Cheers, Miguel _________________________________________________________________ M?s r?pido, sencillo y seguro. Desc?rgate ya el nuevo Internet Explorer 8 ?Es gratis! http://www.vivelive.com/ie8 -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue Apr 7 10:57:56 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Tue, 7 Apr 2009 16:57:56 +0200 Subject: [wxruby-users] Icons show transparent background as black Message-ID: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> Greetings, On OSX 10.5.6, when I attempt to create a TaskBar Icon from a PNG using the sample code shown in (I think bigdemo.rb), with some PNGs, (the ones that I create) the icon shows up with the transparent background shown as black. I've tried different variations of loading the image, using init_alph, convert_alpha_to_mask, etc., all with the same results. I've also tried creating the image with several different programs, Seashore, GIMP, Acorn, again all with the same results. The only way I've been able to successfully get an icon with a transparent background is to use ICOFX on Windows to convert my PNG to a windows .ico, but the results seem sub-optimal to me. All of the PNGs I've created show that the background is transparent in the creating program, in Preview, as well as Camino and Firefox, so I don't think it is a problem with the way I'm creating the image. I'm wondering if it is a problem with the way I'm loading the image, or if this is a bug in Wx, and in any case if there is something I can do to get around this problem. The method below does work with some images, just not the ones that I create with other than ICOFX. I'm a newbie as far as image manipulation is concerned, so I would appreciate any level of help. ---- def make_icon(imgname) # Different platforms have different requirements for the # taskbar icon size filename = "#{Environment.app_root}/image/#{imgname}" img = Wx::Image.new(filename) if Wx::PLATFORM == "WXMSW" img = img.scale(32, 32) elsif Wx::PLATFORM == "WXGTK" img = img.scale(22, 22) elsif Wx::PLATFORM == "WXMAC" # img = img.scale(16, 16) end # WXMAC can be any size up to 128x128, so don't scale icon = Wx::Icon.new icon.copy_from_bitmap(Wx::Bitmap.new(img)) return icon end ----- -- Posted via http://www.ruby-forum.com/. From bureaux.sebastien at neuf.fr Tue Apr 7 13:15:27 2009 From: bureaux.sebastien at neuf.fr (sebastien) Date: Tue, 7 Apr 2009 19:15:27 +0200 Subject: [wxruby-users] Grid Message-ID: Bonjour. Est-il possible de supprimer l'espace se situant entre la derni?re colonne et la scrollbar?, car il y a toujours un espace restant. J'ai essayer de le supprimer en changeant les tailles, mais rien ? faire. Je vous remercie. S?bastien http://beusse.liveror.com/ -------------- section suivante -------------- Une pi?ce jointe HTML a ?t? nettoy?e... URL: From penguinroad at gmail.com Tue Apr 7 22:56:19 2009 From: penguinroad at gmail.com (hendra kusuma) Date: Wed, 8 Apr 2009 09:56:19 +0700 Subject: [wxruby-users] tab In-Reply-To: References: <26dadb3d0904021911sb0aa9bbua80af1fa011611f7@mail.gmail.com> Message-ID: <26dadb3d0904071956m63eff696r76ae090068d58b90@mail.gmail.com> Hi, A little question I make my form without a panel I simply put everything on a frame is that why my tab does not working? On Sun, Apr 5, 2009 at 3:34 PM, Mario Steele wrote: > Hello Hendra, > > Unless your attempting to intercept the TAB Key event, it should all be > internally handled by both wxWidgets, and the actual GUI Kit that wxWidgets > utilizes to create the contols on the specific Operating System. > > Some controls, such as a TextCtrl, with TE_MULTILINE, will eat the TAB key > event, in which case, you need to monitor the Key events on that specific > control, to intercept the tab key, and decide how you want to handle it. > Review the documentation on KeyEvent, to see a few details on it, and take a > look at the example for Caret, as it intercepts key events to do the drawing > handling on the Panel. > > hth > Mario > > 2009/4/2 hendra kusuma > >> Hi there >> >> How to make tab button move the focus to next widget? >> >> Thanks >> Hendra >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > > > -- > Mario Steele > http://www.trilake.net > http://www.ruby-im.net > http://rubyforge.org/projects/wxruby/ > http://rubyforge.org/projects/wxride/ > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Wed Apr 8 04:09:01 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 08 Apr 2009 09:09:01 +0100 Subject: [wxruby-users] tab In-Reply-To: <26dadb3d0904071956m63eff696r76ae090068d58b90@mail.gmail.com> References: <26dadb3d0904021911sb0aa9bbua80af1fa011611f7@mail.gmail.com> <26dadb3d0904071956m63eff696r76ae090068d58b90@mail.gmail.com> Message-ID: <49DC5B9D.6060003@pressure.to> hendra kusuma wrote: > A little question > I make my form without a panel > I simply put everything on a frame > is that why my tab does not working? Yes. A Panel is part of what makes tabbing work. a From lists at ruby-forum.com Wed Apr 8 20:00:55 2009 From: lists at ruby-forum.com (Zhimin Zhan) Date: Thu, 9 Apr 2009 02:00:55 +0200 Subject: [wxruby-users] Help on StyledTextCtrl's hotspots Message-ID: Hi I want to implement a clickable link in StyledTextCtrl, seems hotspots is the way to go (when mouse hove on hotspot, cursor changed to 'hand', can fire a click event). My code (below) only works when a lexer is not set! Is there a way to dynamically set certain text to be hotspots? def initialize set_lexer(STC_LEX_RUBY) # if set, the hotspot style is lost # ... set_hotspot_active_underline(true) style_set_hot_spot(STYLE_FUNCTION, true) evt_stc_hotspot_click(self.id) { |event| puts "clicked hotspot" } # ... end # calling from controller when ready def make_function_clickable(start_pos, length) @style_mask = 255 self.start_styling(start_pos, @style_mask) self.set_styling(length, STYLE_FUNCTION) end Thanks, Zhimin -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Apr 9 18:02:53 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Fri, 10 Apr 2009 00:02:53 +0200 Subject: [wxruby-users] Icons show transparent background as black In-Reply-To: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> References: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> Message-ID: <8bf7c452aa097dcff7f6ff73a8a84500@ruby-forum.com> Bump. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Apr 9 22:09:41 2009 From: lists at ruby-forum.com (Pierre Pierre) Date: Fri, 10 Apr 2009 04:09:41 +0200 Subject: [wxruby-users] Titled border Message-ID: Hi folks, I have a few ListBox controls in my small app, and I wanted to put a kind of title above each of them. The easiest and somehow best looking solution I had thought of, was a kind of border around the ListBox which would have some text at it's top. ( for instance like: http://www.cloudgarden1.com/swing_tutorial/titled_border.png the left circle ). Is there anything like that in the API? I had a look but couldn't find anything... Regards, Pierre -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Apr 10 01:14:35 2009 From: lists at ruby-forum.com (Pierre Pierre) Date: Fri, 10 Apr 2009 07:14:35 +0200 Subject: [wxruby-users] ListBox's overlapping Message-ID: <85134f55162aed4ede917fc2b7e9cd36@ruby-forum.com> Guys, I have a bug which I can't solve at the moment. I tried various solutions, changing the sizers and lots of different ways, I still couldn't fix it. In my code, I have basically two ListBox in the same panel, one above the other. When the upper ListBox has too many elements, I have a nice scroll bar, and looks good. But When I resize my complete frame, it draws itself over the bottom one, and I can't see it anymore. And the scroll bar is even gone, so I can't even see all the elements. Here is my code: def initialize title, xml_h super(nil, -1, title) @xml_helper = xml_h global_sizer = BoxSizer.new(VERTICAL) @top_p = Panel.new(self) @bottom_p = Panel.new(self) global_sizer.add(@top_p, 3, GROW|ALL, 2) global_sizer.add(@bottom_p, 1, GROW|ALL, 2) top_sizer = BoxSizer.new(HORIZONTAL) @m_list = ListBox.new(@top_p, -1, DEFAULT_POSITION, DEFAULT_SIZE, @xml_helper.get_magicians, LB_SINGLE|LB_SORT|DOUBLE_BORDER) evt_listbox @m_list, :on_magician_pressed top_sizer.add(@m_list,1, GROW|ALL, 2) @mc = MediaCtrl.new(@top_p) evt_media_loaded @mc,:on_media_loaded top_sizer.add(@mc, 3, GROW|ALL, 2) right_sizer = GridSizer.new(2, 0, 2, 2) right_p = Panel.new(@top_p) right_p.fit right_p.set_sizer right_sizer @v_list = ListBox.new(right_p, -1, DEFAULT_POSITION, DEFAULT_SIZE, [], LB_SINGLE) evt_listbox @v_list, :on_video_pressed right_sizer.add @v_list @t_list = ListBox.new(right_p, -1, DEFAULT_POSITION, DEFAULT_SIZE, [], LB_SINGLE) evt_listbox @t_list, :on_trick_pressed right_sizer.add @t_list top_sizer.add(right_p, 1, ALIGN_RIGHT, 2) @top_p.sizer = top_sizer self.sizer = global_sizer show end Note that the @bottom_p isn't used, but will be later, once I have fixed that. So the problematic code lies with the right_sizer and the right_p (p for Panel) The @v_list is the upper ListBox and @t_list is the bottom one. Appreciate the help, Pierre -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri Apr 10 08:17:37 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 10 Apr 2009 13:17:37 +0100 Subject: [wxruby-users] Titled border In-Reply-To: References: Message-ID: <49DF38E1.7040504@pressure.to> Hi Pierre Pierre Pierre wrote: > I have a few ListBox controls in my small app, and I wanted to put a > kind of title above each of them. > The easiest and somehow best looking solution I had thought of, was a > kind of border around the ListBox which would have some text at it's > top. ( for instance like: > http://www.cloudgarden1.com/swing_tutorial/titled_border.png the left > circle ). > > Is there anything like that in the API? I had a look but couldn't find > anything... > The control you want is Wx::StaticBox (and also see Wx::StaticBoxSizer) http://wxruby.rubyforge.org/doc/staticbox.html a From lists at ruby-forum.com Sat Apr 11 10:39:18 2009 From: lists at ruby-forum.com (Michael Satterwhite) Date: Sat, 11 Apr 2009 16:39:18 +0200 Subject: [wxruby-users] Wx::Timer Message-ID: I want to process and event at regular time intervals. It appears that Wx::Timer should do the job, but I haven't been able to figure out how to use in in wxruby. The documentation for this is still for C++. I've tried the following: (In my form class's initialize method): @timer = Wx::Timer.new evt_timer(@timer.id) {|event| onTimer(event)} @timer.start(1000) Later in the form, I have the onTimer routine defined. The problem is that its never being called. Does anyone know how to use Wx::Timer? Thanks in advance ---Michael -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Apr 14 01:58:12 2009 From: lists at ruby-forum.com (Pierre Pierre) Date: Tue, 14 Apr 2009 07:58:12 +0200 Subject: [wxruby-users] Titled border In-Reply-To: <49DF38E1.7040504@pressure.to> References: <49DF38E1.7040504@pressure.to> Message-ID: <72aa3a99545f09922bce49e1e97a84db@ruby-forum.com> Alex Fenton wrote: > Hi Pierre > > Pierre Pierre wrote: >> > The control you want is Wx::StaticBox (and also see Wx::StaticBoxSizer) > > http://wxruby.rubyforge.org/doc/staticbox.html > > a Thanks Alex, that was indeed the control I was looking for! Yet, somehow, I quite didn't get how to use it. For instance if if I want to add an other control in it (ListBox, StaticText, whatever), it'll also be in the top-left corner on the top of the border, instead of in it's center. I guess I'm missing something really basic, I just couldn't figure out yet what. -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Apr 14 07:24:44 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 14 Apr 2009 12:24:44 +0100 Subject: [wxruby-users] Titled border In-Reply-To: <72aa3a99545f09922bce49e1e97a84db@ruby-forum.com> References: <49DF38E1.7040504@pressure.to> <72aa3a99545f09922bce49e1e97a84db@ruby-forum.com> Message-ID: <49E4727C.3050809@pressure.to> Pierre Pierre wrote: > Thanks Alex, that was indeed the control I was looking for! > Yet, somehow, I quite didn't get how to use it. > For instance if if I want to add an other control in it (ListBox, > StaticText, whatever), it'll also be in the top-left corner on the top > of the border, instead of in it's center. With Sizer-based layouts (recommended) I've found it easier to use Wx::StaticBoxSizer to get a label round controls. I probably should have pointed you at this first. See the simple example below: alex __ require 'wx' Wx::App.run do frame = Wx::Frame.new(nil, :title => 'staticbox demo') panel = Wx::Panel.new(frame) sizer = Wx::StaticBoxSizer.new( Wx::VERTICAL, panel, 'a label') sizer.add( Wx::ListBox.new(panel), 1, Wx::ALL|Wx::GROW, 5 ) panel.sizer = sizer frame.show end From alex at pressure.to Tue Apr 14 07:47:22 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 14 Apr 2009 12:47:22 +0100 Subject: [wxruby-users] Icons show transparent background as black In-Reply-To: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> References: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> Message-ID: <49E477CA.7090800@pressure.to> Daniel Zepeda wrote: > On OSX 10.5.6, when I attempt to create a TaskBar Icon from a PNG using > the sample code shown in (I think bigdemo.rb), with some PNGs, (the ones > that I create) the icon shows up with the transparent background shown > as black. > I'm not sure exactly what is happening here, but I know that it does work in my app. I checked the code I use to load the icon and it's similar to yours - no extra calls to mask/alpha functions needed. The icon image file is 128x128, RGB, 8 bits / channel. You might want to check the depth and bits / channel being saved - I use Pixelmator but I'm sure the other image programs you mention should work. If you want to post the image as an attachment I'm happy to try tinkering with it. alex From alex at pressure.to Tue Apr 14 08:07:26 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 14 Apr 2009 13:07:26 +0100 Subject: [wxruby-users] ListBox's overlapping In-Reply-To: <85134f55162aed4ede917fc2b7e9cd36@ruby-forum.com> References: <85134f55162aed4ede917fc2b7e9cd36@ruby-forum.com> Message-ID: <49E47C7E.8020206@pressure.to> Hi Pierre Pierre Pierre wrote: > I have a bug which I can't solve at the moment. I tried various > solutions, changing the sizers and lots of different ways, I still > couldn't fix it. > > In my code, I have basically two ListBox in the same panel, one above > the other. > When the upper ListBox has too many elements, I have a nice scroll bar, > and looks good. But When I resize my complete frame, it draws itself > over the bottom one, and I can't see it anymore. And the scroll bar is > even gone, so I can't even see all the elements. > > Here is my code: > > def initialize title, xml_h [ ... ] I'm afraid that most people who might be able to help with this don't have time to work through a long snippet this copied straight from an application, and figure out what's going on. If you want help with code, please reduce it to a bare minimum that runs on its own, and demonstrates just the problem. Please see the guidelines here: http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists The kind of problem you describe with items overlapping is usually caused by failing to add some control to a sizer, or adding it to the wrong sizer (eg not one belonging to its parent). I would check through the controls for this. Perhaps also consider using or at least prototyping using an XRC editor like DialogBlocks for layouts, which can really help understanding sizers. Lastly I suggest also reading the Style Guide, which will help you structure and write wxRuby code in a more readable way: http://wxruby.rubyforge.org/wiki/wiki.pl?StyleGuide hth alex From alex at pressure.to Tue Apr 14 08:11:16 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 14 Apr 2009 13:11:16 +0100 Subject: [wxruby-users] Wx::Timer In-Reply-To: References: Message-ID: <49E47D64.5090004@pressure.to> Michael Satterwhite wrote: > I want to process and event at regular time intervals. It appears that > Wx::Timer should do the job, but I haven't been able to figure out how > to use in in wxruby. The documentation for this is still for C++. The introductory documentation here: http://wxruby.rubyforge.org/doc/timer.html is correct for Ruby (though it seems to have a few formatting errors). For what you want the best way would be as the first example on that page: Wx::Timer.every(500) do puts "Tick" end hth alex From rakaur at malkier.net Tue Apr 14 17:26:00 2009 From: rakaur at malkier.net (Eric Will) Date: Tue, 14 Apr 2009 17:26:00 -0400 Subject: [wxruby-users] 1.9 win32 Message-ID: <1ce38ef40904141426w747f4b68ha26bc5b30f782cb0@mail.gmail.com> I'm sure this has been brought up before but I haven't heard anything lately. When is there going to be a wxruby-ruby19 for Windows? -- Eric Will From alex at pressure.to Tue Apr 14 18:29:28 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 14 Apr 2009 23:29:28 +0100 Subject: [wxruby-users] 1.9 win32 In-Reply-To: <1ce38ef40904141426w747f4b68ha26bc5b30f782cb0@mail.gmail.com> References: <1ce38ef40904141426w747f4b68ha26bc5b30f782cb0@mail.gmail.com> Message-ID: <49E50E48.6040805@pressure.to> Eric Will wrote: > I'm sure this has been brought up before but I haven't heard anything lately. > > When is there going to be a wxruby-ruby19 for Windows? There already is - the mingw32 build for Ruby 1.9. There's also an all-in-one installing providing Ruby 1.9 and wxRuby 2.0. wxRuby 2.0 doesn't currently compile with the version of Microsoft's compiler used for some Ruby 1.9 binary offering from elsewhere (MSVC9). Personally I'm open to working on this at some stage, but I'd like some clearer signals from the ruby core dev team or wider ruby community about which is going to become the preferred compiler for Ruby 1.9 before committing the resources needed to supporting another set up. hth alex From alex at pressure.to Tue Apr 14 18:50:36 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 14 Apr 2009 23:50:36 +0100 Subject: [wxruby-users] Help building wxRuby with VC8 In-Reply-To: References: Message-ID: <49E5133C.2020309@pressure.to> Hi Miguel Sorry for being slow to reply. I think you might be onto something with SWIG versions... Miguel Mu?oz Aranc?n wrote: > > Your configuration is not (yet?) supported. > > I was afraid of this. Unfortunately I cannot change to MinGW because I > need > to interface with a C++ application that I cannot port. That's a shame. As I mentioned in another email, I'm open to working on supporting MSVC9 if it becomes clear that that's the preferred basis for Ruby 1.9 on Windows. > > > Class: AboutDialogInfo > > > ERROR! swig/fixmodule.rb Didn't find swig class > > Regarding the third problem, it seems that fixmodule.rb looks for some > declarations > of swig_class variables that don't exist. It seems that they are not > generated at > all by SWIG, so there could be some problem before VC8 does anything. > Which > exact version of SWIG is proven to work with wxRuby? (The build > instructions say > only "any recent version"). Rake should test that you have a recent enough version of SWIG to work with your version of Ruby - it's near the top of wxRuby's rakefile (SWIG_MINIMUM_VERSION). I just had a look at SWIG's website and they've released versions 1.3.38 and 1.3.39 since wxRuby 2.0 was released. I did a quick diff on the ruby changes and they look significant enough that these new versions might break wxRuby. I would strongly suggest dropping back to 1.3.37 and seeing if that helps. We used to test for SWIG_MAXIMUM_VERSION as SWIG makes no guarantees about backwards or forwards compatibility between versions. I guess we may need to go back to this. > In case that it's useful to diagnose my problem, I'll add some more > information. I > got wxRuby 2.0.0 to build against Ruby 1.8.7 with the following > modifications: > > - remove the call to fixmodule.rb in rake/rakewx.rb; this script looks > for declarations > like "swig_class cXXXXX" that are not extern, but there are no such > declarations in > my SWIG generated code. > > - add some variable declarations in swig/wx.i: > swig_class cWxWindow; > swig_class cWxTopLevelWindow; > swig_class cWxSize; > swig_class cWxEvent; > swig_class cWxEvtHandler; > > I installed wxRuby and set the executable manifest as explained in the > wiki, but > when I run "require 'Wx'" the interpreter crashes with an unhandled > exception, so > obviously that's not the correct solution. As you guessed, the kind of error "no class found" you're getting from fixmodule.rb is a sign that something has gone wrong in generating the code for that class - it's either a SWIG version problem or something that needs fixing elsewhere. alex From alex at pressure.to Tue Apr 14 18:56:25 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 14 Apr 2009 23:56:25 +0100 Subject: [wxruby-users] Help on StyledTextCtrl's hotspots In-Reply-To: References: Message-ID: <49E51499.1040202@pressure.to> Hi Zhimin Zhimin Zhan wrote: > I want to implement a clickable link in StyledTextCtrl, seems hotspots > is the way to go (when mouse hove on hotspot, cursor changed to 'hand', > can fire a click event). > > My code (below) only works when a lexer is not set! > > Is there a way to dynamically set certain text to be hotspots? To be honest, I'm not sure. I would look for help via Scintilla on this - as you probably guessed, StyledTextCtrl is a pretty thin layer of this editing component. This page here would suggest that if a lexer is present, it has control of setting hotspots: http://www.mail-archive.com/scintilla-interest at lyra.org/msg00210.html This may mean it's not possible, or not possible without writing your own lexer. Whether this is possible in Ruby with StyledTextCtrl I don't know - I haven't explored the (large) STC API enough to know. But it would be interesting.... alex From lists at ruby-forum.com Tue Apr 14 20:42:53 2009 From: lists at ruby-forum.com (Pierre Pierre) Date: Wed, 15 Apr 2009 02:42:53 +0200 Subject: [wxruby-users] ListBox's overlapping In-Reply-To: <49E47C7E.8020206@pressure.to> References: <85134f55162aed4ede917fc2b7e9cd36@ruby-forum.com> <49E47C7E.8020206@pressure.to> Message-ID: <4a07e814645bdd5be618933fc397736a@ruby-forum.com> Alex, Thanks again for this reply as well. Actually, I have fixed that issue, by simplifying the behavior (not 100% what I wanted) and also changing the sizer. Thanks also for that Style Guide, it will definitely help me. Cheers! -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Apr 14 20:46:42 2009 From: lists at ruby-forum.com (Pierre Pierre) Date: Wed, 15 Apr 2009 02:46:42 +0200 Subject: [wxruby-users] Titled border In-Reply-To: <49E4727C.3050809@pressure.to> References: <49DF38E1.7040504@pressure.to> <72aa3a99545f09922bce49e1e97a84db@ruby-forum.com> <49E4727C.3050809@pressure.to> Message-ID: Awesome Alex! Thank to you it looks like I'll have a great and productive day today :-) Big thanks -- Posted via http://www.ruby-forum.com/. From luciano.zanotto at polimi.it Wed Apr 15 06:52:04 2009 From: luciano.zanotto at polimi.it (Luciano Zanotto) Date: Wed, 15 Apr 2009 12:52:04 +0200 Subject: [wxruby-users] Validator problem Message-ID: <49E5BC54.1070201@polimi.it> Hi everubody, I'm new to wxRuby and I have a problem with Validator/TextValidator object. I'm actually trying to develop an extension to OpenStudio, a plugin for Google SketchUp. When I create a Validator or a control using a Validator (I'm using the TextValidator) anything seems to work fine. But I don't get to have the changes in the variables bound to the controls transferred to the window. From the wxWidgets documentation it seems I should call the TransferDataToWindow method of the Window object, but this method is not listed in the wxRuby port. Has anyone faced the problem before? Could anyone help me? It just seems that wxWidgets has not been fully ported yet. Thanks in advance Ciao Luciano From lists at ruby-forum.com Wed Apr 15 07:38:47 2009 From: lists at ruby-forum.com (Zhimin Zhan) Date: Wed, 15 Apr 2009 13:38:47 +0200 Subject: [wxruby-users] Help on StyledTextCtrl's hotspots In-Reply-To: <49E51499.1040202@pressure.to> References: <49E51499.1040202@pressure.to> Message-ID: <4cc57d58fb3b8e3e3dcb5c58c4406a42@ruby-forum.com> Thanks Alex. The link you pointed out has most related information on this topic, it seems too low level for me, probably will be easier to write my own lexer. Zhimin -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Apr 15 07:40:32 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 15 Apr 2009 12:40:32 +0100 Subject: [wxruby-users] Validator problem In-Reply-To: <49E5BC54.1070201@polimi.it> References: <49E5BC54.1070201@polimi.it> Message-ID: <49E5C7B0.5080008@pressure.to> Luciano Zanotto wrote: > Hi everubody, I'm new to wxRuby and I have a problem with > Validator/TextValidator object. I'm actually trying to develop an > extension to OpenStudio, a plugin for Google SketchUp. When I create a > Validator or a control using a Validator (I'm using the TextValidator) > anything seems to work fine. But I don't get to have the changes in > the variables bound to the controls transferred to the window. From > the wxWidgets documentation it seems I should call the > TransferDataToWindow method of the Window object, but this method is > not listed in the wxRuby port. Has anyone faced the problem before? > Could anyone help me? It just seems that wxWidgets has not been fully > ported yet. Validators in wxRuby only do the "validating" stuff, they don't do transferring data to and from variables - you can see if you look at the Ruby docs for Validator: http://wxruby.rubyforge.org/doc/validator.html This is a deliberate omission not an oversight - variables in Ruby are always references, just names for things, so the semantics of assignment are not the same as in C++. To retrieve values from controls in dialogs, just do normal assignment in an event handler (eg when the 'OK' button is pressed). There are some parts of wxWidgets not in wxRuby, but these are with a few exceptions deliberate decisions reflecting the differences in the target languages. a From alex at pressure.to Wed Apr 15 08:10:44 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 15 Apr 2009 13:10:44 +0100 Subject: [wxruby-users] Help on StyledTextCtrl's hotspots In-Reply-To: <4cc57d58fb3b8e3e3dcb5c58c4406a42@ruby-forum.com> References: <49E51499.1040202@pressure.to> <4cc57d58fb3b8e3e3dcb5c58c4406a42@ruby-forum.com> Message-ID: <49E5CEC4.5030705@pressure.to> Zhimin Zhan wrote: > The link you pointed out has most related information on this topic, it > seems too low level for me, probably will be easier to write my own > lexer. In that case the following links might be helpful: http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3645151 http://www.scintilla.org/ScintillaDoc.html#SCN_STYLENEEDED In wxRuby the form of event handling for custom lexing will look something like evt_stc_styleneeded(self) do | evt | start_pos = end_styled line_num = line_from_position( start_pos ) start_pos = position_from_line( line_num ) # start styling at position start_styling(start_pos, 31) # do whatever styling is needed to text chunks set_styling(evt.position - start_pos, 2) end good luck! a From rakaur at malkier.net Wed Apr 15 10:14:25 2009 From: rakaur at malkier.net (Eric Will) Date: Wed, 15 Apr 2009 10:14:25 -0400 Subject: [wxruby-users] 1.9 win32 In-Reply-To: <49E50E48.6040805@pressure.to> References: <1ce38ef40904141426w747f4b68ha26bc5b30f782cb0@mail.gmail.com> <49E50E48.6040805@pressure.to> Message-ID: <1ce38ef40904150714n15e9d0c3m1840921684256a5b@mail.gmail.com> Apparently the current win32 mysql gem will not work with your mingw32.exe installer. On Tue, Apr 14, 2009 at 6:29 PM, Alex Fenton wrote: > Eric Will wrote: >> >> I'm sure this has been brought up before but I haven't heard anything >> lately. >> >> When is there going to be a wxruby-ruby19 for Windows? > > There already is - the mingw32 build for Ruby 1.9. There's also an > all-in-one installing providing Ruby 1.9 and wxRuby 2.0. > > wxRuby 2.0 doesn't currently compile with the version of Microsoft's > compiler used for some Ruby 1.9 binary offering from elsewhere (MSVC9). > > Personally I'm open to working on this at some stage, but I'd like some > clearer signals from the ruby core dev team or wider ruby community about > which is going to become the preferred compiler for Ruby 1.9 before > committing the resources needed to supporting another set up. > > hth > alex > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From alex at pressure.to Wed Apr 15 17:33:16 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 15 Apr 2009 22:33:16 +0100 Subject: [wxruby-users] 1.9 win32 In-Reply-To: References: <1ce38ef40904141426w747f4b68ha26bc5b30f782cb0@mail.gmail.com> <49E50E48.6040805@pressure.to> <1ce38ef40904150714n15e9d0c3m1840921684256a5b@mail.gmail.com> Message-ID: <49E6529C.7020408@pressure.to> Mario Steele wrote: > That's probably because the current win32 mysql gem, is built with > MSVC, instead of MinGW. There are some gems that you have to rebuild > for the MinGW Version of the Ruby Interpreter. As Mario says, this is the unfortunate situation with Ruby 1.9 on Windows. Projects that depend on compilation (like wxRuby, MySQL ... and lots of others) don't really know whether to work on supporting MingW or MSVC. Most don't yet support either. > You may want to look at Luis Lavena's Installer3 Framework, to build > the MinGW version of Ruby. Unfortunately, I don't remember the URL > offhand, but you should be able to find it being discussed in the > archives of the Mailing List, and through using Google. See the link in this post - think this is current recommended route for setting up MingW Ruby 1.9 with developer tools so you can compile (some) gems. http://rubyforge.org/pipermail/rubyinstaller-devel/2009-April/000534.html hth alex From alex at pressure.to Wed Apr 15 17:34:31 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 15 Apr 2009 22:34:31 +0100 Subject: [wxruby-users] 1.9 win32 In-Reply-To: <1ce38ef40904150714n15e9d0c3m1840921684256a5b@mail.gmail.com> References: <1ce38ef40904141426w747f4b68ha26bc5b30f782cb0@mail.gmail.com> <49E50E48.6040805@pressure.to> <1ce38ef40904150714n15e9d0c3m1840921684256a5b@mail.gmail.com> Message-ID: <49E652E7.9040906@pressure.to> Eric Will wrote: > Apparently the current win32 mysql gem will not work with your > mingw32.exe installer. PS - there is a fork of ruby-mysql to support MySQL on MingW http://rubyforge.org/pipermail/rubyinstaller-devel/2009-April/000534.html alex From lists at ruby-forum.com Wed Apr 15 19:35:20 2009 From: lists at ruby-forum.com (Zhimin Zhan) Date: Thu, 16 Apr 2009 01:35:20 +0200 Subject: [wxruby-users] Displaying Asian characters in StyledTextCtrl Message-ID: <68ce38c1236821bdb5b06b84ddf55ffc@ruby-forum.com> Hi, I used r18n-desktop (http://r18n.rubyforge.org/) for localization, it worked well. But I have trouble displaying Chinese characters in StyledTextCtrl, On Mac, the control accepts characters, but failed to save (could be problems in my application, the file becomes empty) on Windows, typed or copied chinese characters showed as blocks, failed to save as well. I did a search 'Unicode' in this forum, couldn't find relevant posts. Thanks, Zhimin -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Apr 16 00:47:03 2009 From: lists at ruby-forum.com (Zhimin Zhan) Date: Thu, 16 Apr 2009 06:47:03 +0200 Subject: [wxruby-users] Displaying Asian characters in StyledTextCtrl In-Reply-To: References: <68ce38c1236821bdb5b06b84ddf55ffc@ruby-forum.com> Message-ID: <6237f921e00db27f05166cee51aac2ef@ruby-forum.com> Thanks Mario > http://wxruby.rubyforge.org/doc/styledtextctrl.html#text_encoding I did notice this as well, few meaningful examples found on Internet. def initialize super() self.set_code_page(STC_CP_UTF8) end The problem (not being able to save the file) remains. Regards, Zhimin -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Apr 16 01:54:38 2009 From: lists at ruby-forum.com (Zhimin Zhan) Date: Thu, 16 Apr 2009 07:54:38 +0200 Subject: [wxruby-users] Displaying Asian characters in StyledTextCtrl In-Reply-To: References: <68ce38c1236821bdb5b06b84ddf55ffc@ruby-forum.com> <6237f921e00db27f05166cee51aac2ef@ruby-forum.com> Message-ID: <7f1025fee0938415db7531dfc152b8c3@ruby-forum.com> > How exactly are you saving the file? class EditorSession < Wx::StyledTextCtrl def initialize super # ... self.set_code_page(STC_CP_UTF8) # ... end def save_file(name) puts "calling save file #{name} " begin super puts "saved Ok" # ... rescue => e puts "error: saving file: #{e}" logger.warn "failed to save #{name}: #{e}" end end Output: calling save file F:/samples/chinese_spec.rb saved Ok Then the file content is cleared. Zhimin -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Apr 18 14:40:00 2009 From: lists at ruby-forum.com (Michael Satterwhite) Date: Sat, 18 Apr 2009 20:40:00 +0200 Subject: [wxruby-users] Control Sizing Message-ID: <9405623bd92dcf3f83d087f91f27309d@ruby-forum.com> I'm still having trouble getting the intricities of Control sizing through my head. I'm using wxFormBuilder to build my screen, but I can subclass and write code as needed ... if I knew what code is needed. I have a form with a vertical sizer that contains a label and a ListBox control. The label has a proportion of 0, the listbox of 1. When the form is created, the listbox is only tall enough to contain about 3 items - very short screen. I want it to be tall enough for at least 10 items. problem: I have no idea how to reasonably control the size of a control (in this case listbox) I am calling self.fit - which I *THINK* may be the problem. If I don't call that, however, the screen comes up so narrow that the controls on the right are cut off - which is much worse than the sort listbox. Would one of the experts here be so kind as to help me in understanding how to control something such as this? Thanks in advance ---Michael -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sat Apr 18 14:56:03 2009 From: alex at pressure.to (Alex Fenton) Date: Sat, 18 Apr 2009 19:56:03 +0100 Subject: [wxruby-users] Control Sizing In-Reply-To: <9405623bd92dcf3f83d087f91f27309d@ruby-forum.com> References: <9405623bd92dcf3f83d087f91f27309d@ruby-forum.com> Message-ID: <49EA2243.6060708@pressure.to> Michael Satterwhite wrote: > I have a form with a vertical sizer that contains a label and a ListBox > control. The label has a proportion of 0, the listbox of 1. When the > form is created, the listbox is only tall enough to contain about 3 > items - very short screen. I want it to be tall enough for at least 10 > items. problem: I have no idea how to reasonably control the size of a > control (in this case listbox) > > I am calling self.fit - which I *THINK* may be the problem. If I don't > call that, however, the screen comes up so narrow that the controls on > the right are cut off - which is much worse than the sort listbox. Perhaps calling something like: list_box.min_size = [250, 400] (and then possibly, sizer.layout, to update the layout) Calling this advises the sizer of a minimum size for the relevant widget to be allocated in the layout http://wxruby.rubyforge.org/doc/window.html#Window_setminsize alex From lists at ruby-forum.com Sat Apr 18 21:09:40 2009 From: lists at ruby-forum.com (Michael Mcandrews) Date: Sun, 19 Apr 2009 03:09:40 +0200 Subject: [wxruby-users] FlexibleGrid column sizing Message-ID: <6b4a0f478d17ec2fa8c9917930a4824e@ruby-forum.com> OK, I'm relatively new to wxruby, but have gotten a few forms successful, and so building up some experience, but have run into a major challenge with the following issue. I want to generate a table-like thing, that has a known number of columns, but a variable number of rows, but the number of rows will be 25 or less; all the rows are to be the same height, but the columns need to be all different widths. So I was using a FlexGridSizer, set the number of columns and rows; I am able to put the sizer into a form and able to put controls into the FlexGrid control without any proble. However all the columns are the same width, and I can't find any combination of flags that will make the the columns anything other than the width of the widest column. Most of the controls going into the grid are TextCtrls and I have specified the "maximum_size" attribute as a Size.new(x,-1) with the following flags: ALIGN_LEFT | ST_NO_AUTORESIZE. When adding the controls to the FlexGrid to "proportion" field is set to zero. And yet all the columns are the same width, the width of the widest sub-control. How can one specify a maximum column size? How does one have a FlexGrid recompute the column widths? Is FlexGrid the wrong thing to do this with? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Apr 19 14:24:03 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Sun, 19 Apr 2009 20:24:03 +0200 Subject: [wxruby-users] [ANN] wxRubyTemplate Message-ID: <87e7a2296e5dec2f8f19048abadde747@ruby-forum.com> Hey folks, You may be interested in a project I've published on Github, wxRubyTemplate. See the blog post and visit the project on Github. http://daniel.zepeda.ws/blog/2009/04/18/announcement-wxrubytemplate/ Introduction The aim of the wxRubyTemplate is to provide a starting structure within which to program your wxRuby project. The template provides a directory structure, a set of Rakefiles to manage, and most importantly, to _package_ your Ruby application for distribution as a standalone program when completed. It also includes an environment to get the application running and provide basic services to the program code. For now, the template only supports packaging for Mac OSX and Windows, although various flavors of Linux should be easily accommodated and are planned for the future. Let me know what you think. DZ -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Apr 19 17:43:30 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Sun, 19 Apr 2009 23:43:30 +0200 Subject: [wxruby-users] Icons show transparent background as black In-Reply-To: <49E477CA.7090800@pressure.to> References: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> <49E477CA.7090800@pressure.to> Message-ID: Thanks Alex, I appreciate your time. I've attached an example image. This was the result of taking two pre-existing images (I think they were jpegs), adding an alpha channel, selecting and deleting the areas I wanted to be transparent, and then putting one over the other in different layers. Like my other efforts, the areas I want to be transparent (basically the entire border around the globe) appears transparent in every program I've tried, except for loading it in wxRuby. I have no idea what is wrong with it, or how to even find out what is wrong with it, so anything you can tell me to point me in the right direction will be appreciated. Thanks! DZ Alex Fenton wrote: > If you want to post the image as an attachment I'm happy to try > tinkering with it. > > alex Attachments: http://www.ruby-forum.com/attachment/3593/image_test.png -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sun Apr 19 18:43:19 2009 From: alex at pressure.to (Alex Fenton) Date: Sun, 19 Apr 2009 23:43:19 +0100 Subject: [wxruby-users] FlexibleGrid column sizing In-Reply-To: <6b4a0f478d17ec2fa8c9917930a4824e@ruby-forum.com> References: <6b4a0f478d17ec2fa8c9917930a4824e@ruby-forum.com> Message-ID: <49EBA907.3060105@pressure.to> Hi Michael Mcandrews wrote: > OK, I'm relatively new to wxruby, but have gotten a few forms > successful, and so building up some experience, but have run into a > major challenge with the following issue. I want to generate a > table-like thing, that has a known number of columns, but a variable > number of rows, but the number of rows will be 25 or less; all the rows > are to be the same height, but the columns need to be all different > widths. > > So I was using a FlexGridSizer, set the number of columns and rows; I am > able to put the sizer into a form and able to put controls into the > FlexGrid control without any proble. However all the columns are the > same width, and I can't find any combination of flags that will make the > the columns anything other than the width of the widest column. Most of > the controls going into the grid are TextCtrls and I have specified the > "maximum_size" attribute as a Size.new(x,-1) with the following flags: > ALIGN_LEFT | ST_NO_AUTORESIZE. When adding the controls to the > FlexGrid to "proportion" field is set to zero. And yet all the columns > are the same width, the width of the widest sub-control. > > How can one specify a maximum column size? How does one have a FlexGrid > recompute the column widths? Is FlexGrid the wrong thing to do this > with? > You probably want to call FlexGridSizer#add_growable_col with a proportion > 0 on at least one column in the sizer. That column will then receive available additional space, and the other columns will have the minimum size for their controls. If all proportions == 0, the available space is distributed evenly between all columns: http://wxruby.rubyforge.org/doc/flexgridsizer.html#FlexGridSizer_addgrowablecol a From alex at pressure.to Sun Apr 19 19:04:14 2009 From: alex at pressure.to (Alex Fenton) Date: Mon, 20 Apr 2009 00:04:14 +0100 Subject: [wxruby-users] Icons show transparent background as black In-Reply-To: References: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> <49E477CA.7090800@pressure.to> Message-ID: <49EBADEE.20003@pressure.to> Daniel Zepeda wrote: > Thanks Alex, I appreciate your time. I've attached an example image. > This was > the result of taking two pre-existing images (I think they were jpegs), > adding an alpha channel, selecting and deleting the areas I wanted to be > transparent, and then putting one over the other in different layers. > > Like my other efforts, the areas I want to be transparent (basically the > entire border around the globe) appears transparent in every program > I've tried, except > for loading it in wxRuby. Resize the source image file so that it's exactly 128x128 and it seems the problem disappears. I guess some call to resize the image internally if it's not 128x128 is losing the alpha channel on OS X. a From lists at ruby-forum.com Mon Apr 20 00:34:15 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Mon, 20 Apr 2009 06:34:15 +0200 Subject: [wxruby-users] Icons show transparent background as black In-Reply-To: <49EBADEE.20003@pressure.to> References: <04cf3dfe451226c00f918916e739b815@ruby-forum.com> <49E477CA.7090800@pressure.to> <49EBADEE.20003@pressure.to> Message-ID: Alex Fenton wrote: > Daniel Zepeda wrote: > > Resize the source image file so that it's exactly 128x128 and it seems > the problem disappears. > > I guess some call to resize the image internally if it's not 128x128 is > losing the alpha channel on OS X. > > a Yes that did it! I tried resizing it, but not to the maximum. That does the trick with all my task bar images. Thank you Alex. You're always a great help. DZ -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Apr 20 20:24:35 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Tue, 21 Apr 2009 02:24:35 +0200 Subject: [wxruby-users] [ANN] wxRubyTemplate In-Reply-To: <49ECFE50.1070001@pressure.to> References: <87e7a2296e5dec2f8f19048abadde747@ruby-forum.com> <49ECFE50.1070001@pressure.to> Message-ID: <2612ede5d8cad6873e260039592507d9@ruby-forum.com> Alex Fenton wrote: > Hi Daniel > > > Daniel Zepeda wrote: >> which to program your wxRuby project. The template provides a directory >> structure, a set of Rakefiles to manage, and most importantly, to >> _package_ your Ruby application for distribution as a standalone program >> when completed. > > Thanks - this is a positive development. I'd recommend it to anyone > considering a semi-serious app as a model of how to organise a GUI > project. > > A couple of things that I needed to get going: > - rspec should be in the list of requirements Ah yes, thanks. Fixed in the documentation. > - the rakefile can detect which ruby is running it more portably (patch > attached) I read this through the Ruby Forum's web interface, I don't get the emails, so I didn't see the attached patch. Should I change my preferences or something? > - The copying of executables for installation isn't fully working - > app_ruby_executable in tasks/package_lib.rake is probably better > something like "Environment.app_name + Config::CONFIG['EXEEXT']" but > I couldn't quite figure it out. By 'not fully working' do you mean you weren't able to get a working package on Windows? I verified it on my copy of Windows XP, so maybe you are using a different kind of Windows? Really all that does is rename the ruby executable to a name associated with the packaged program. I'm not sure that it is really necessary. Yes, Config::CONFIG['EXEEXT'] would be more portable I suppose, but that code only executes for mswin, so I figured .exe was safe enough. > > More generally it seems there's two distinct tasks here: setting up a > model project, and later packaging. Agreed. The rub is that for the packaging to work right, everything must be required in a specific way, thus packaging successfully is dependent on the project structure, so they really go hand-in-hand. What I was thinking of was a ripped-off idea from rails, have a script that generates the structure and scripts initially, going the 'convention-over-configuration' route as much as possible. The pre-defined structure also makes it easier to get off-and-running on a new project. > Some nice ruby DSL that hid the > details of the .nsi installer file would be great. NSIS has roughly 6 > million options and generally you want about four (what extra files to > include, what version/app name/branding, what shortcuts to create). Ah yes, that is a great idea. I was pondering how to handle the grubby details of NSIS. > > Please keep us posted. Will do. DZ > > alex -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Apr 21 01:53:14 2009 From: alex at pressure.to (Alex Fenton) Date: Tue, 21 Apr 2009 06:53:14 +0100 Subject: [wxruby-users] [ANN] wxRubyTemplate In-Reply-To: <2612ede5d8cad6873e260039592507d9@ruby-forum.com> References: <87e7a2296e5dec2f8f19048abadde747@ruby-forum.com> <49ECFE50.1070001@pressure.to> <2612ede5d8cad6873e260039592507d9@ruby-forum.com> Message-ID: <49ED5F4A.4030500@pressure.to> Daniel Zepeda wrote: > Alex Fenton wrote: > >> - the rakefile can detect which ruby is running it more portably (patch >> attached) >> > > I read this through the Ruby Forum's web interface, I don't get the > emails, so I didn't see the attached patch. Should I change my > preferences or something? > Strange, the reply has also disappeared completely from our own archives: http://rubyforge.org/pipermail/wxruby-users/2009-April/thread.html Patch copied inline below. > By 'not fully working' do you mean you weren't able to get a working > package on Windows? I verified it on my copy of Windows XP, so maybe > you are using a different kind of Windows? > It was on OS X. The methods app_ruby_executable and ruby_executable test RUBY_PLATFORM for "i686-darwin9", but for my standard ruby (/usr/bin/ruby) the platform is "universal-darwin9" so the case statement falls through and raises. That's why I tried def ruby_executable_name Config::CONFIG['RUBY_INSTALL_NAME'] + Config::CONFIG['EXEEXT'] end def app_ruby_executable_name Environment.app_name + Config::CONFIG['EXEEXT'] end But that's not quite all that's needed, because build/bin/ruby hasn't been copied. > Really all that does is rename the ruby executable to a name associated > with the packaged program. I'm not sure that it is really necessary. > It's just a little bit of polish. It affects how the app is labelled in the Dock (OSX) and in Alt-Tab, Task Manager (Windows), otherwise it shows as 'ruby'. > What I was thinking of was a ripped-off idea from rails, have a script > that generates the structure and scripts initially, going the > 'convention-over-configuration' route as much as possible. The > pre-defined structure also makes it easier to get off-and-running on a > new project. > Yep, I've only tried rails once a while ago, but I liked the 'scaffold' feature. best alex diff --git a/Rakefile b/Rakefile index 7750810..4689030 100644 --- a/Rakefile +++ b/Rakefile @@ -15,7 +15,9 @@ end desc "Run Project" task :run => Environment.base_class_path do ENV[Environment.app_env_const] = 'development' - executable = RUBY_PLATFORM =~ /darwin/ ? "/opt/local/bin/ruby" : "c:/ruby-1.8.7-p72/bin/ruby.exe" + executable = File.join( Config::CONFIG['bindir'], + Config::CONFIG['RUBY_INSTALL_NAME'] + + Config::CONFIG['EXEEXT'] ) exec("#{executable} #{Environment.app_file}") end @@ -40,4 +42,4 @@ def make_bases_relative end end -task :default => :spec \ No newline at end of file +task :default => :spec From lists at ruby-forum.com Tue Apr 21 10:14:19 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Tue, 21 Apr 2009 16:14:19 +0200 Subject: [wxruby-users] [ANN] wxRubyTemplate In-Reply-To: <49ED5F4A.4030500@pressure.to> References: <87e7a2296e5dec2f8f19048abadde747@ruby-forum.com> <49ECFE50.1070001@pressure.to> <2612ede5d8cad6873e260039592507d9@ruby-forum.com> <49ED5F4A.4030500@pressure.to> Message-ID: <412f36efa9b3db8d638575c8fa4a23c2@ruby-forum.com> Alex Fenton wrote: > Daniel Zepeda wrote: >> Alex Fenton wrote: >> > > Patch copied inline below. Thanks! > >> By 'not fully working' do you mean you weren't able to get a working >> package on Windows? I verified it on my copy of Windows XP, so maybe >> you are using a different kind of Windows? >> > > It was on OS X. The methods app_ruby_executable and ruby_executable test > RUBY_PLATFORM for "i686-darwin9", but for my standard ruby > (/usr/bin/ruby) the platform is "universal-darwin9" so the case > statement falls through and raises. Ah, I get it now. I was wondering if specifying it so thoroughly would cause a problem, and apparently it does. Probably just shortening the test of ruby platform to /darwin/ would fix that, and shortening the directory names and other things that depend on RUBY_PLATFORM. > That's why I tried > > def ruby_executable_name > Config::CONFIG['RUBY_INSTALL_NAME'] + Config::CONFIG['EXEEXT'] > end > > def app_ruby_executable_name > Environment.app_name + Config::CONFIG['EXEEXT'] > end > > But that's not quite all that's needed, because build/bin/ruby hasn't > been copied. Yeah, again, I think just cutting down the specification of RUBY_PLATFORM should take care of it. It really shouldn't matter, I'm just checking if it's mswin or OSX, I don't think it should matter if it is 386/686 etc. Thanks for the patch. DZ -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue Apr 21 19:29:16 2009 From: lists at ruby-forum.com (Michael Satterwhite) Date: Wed, 22 Apr 2009 01:29:16 +0200 Subject: [wxruby-users] evt_kill_focus Problem Message-ID: I'm trying to process the focus changed event without success. I'm only interested in it if it is a particular control losing focus, but (so far) I haven't been able to get it processed at all. In the event setup, I use the following: evt_kill_focus() {|event| focus_changed(event)} in the focuschanged I do the following def focus_changed(event) if event.get_window.id == @endbox.id #Test whether I'm interested ------ best I can tell, the focus_changed is never called. Could someone point out the right way to do this? Thanks in advance ---Michael -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Apr 22 10:27:32 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 22 Apr 2009 15:27:32 +0100 Subject: [wxruby-users] evt_kill_focus Problem In-Reply-To: References: Message-ID: <49EF2954.8090908@pressure.to> Stephen Belcher wrote: > I think evt_kill_focus is one of those events you have to define > inside the class that will be using it, since it doesn't take an id > parameter. If you don't have a specific class for that one control > (which is most of the time), the somewhat-hacky solution I've used in > the past would look something like: Yes, see the discussion of the distinction between CommandEvents (which "bubble" upwards) and others (which are notified to their generator only). http://wxruby.rubyforge.org/doc/eventhandlingoverview.html There is also ChildFocusEvent, which can be used in Panels &c to check the focus of immediate children. alex From lists at ruby-forum.com Thu Apr 23 21:34:53 2009 From: lists at ruby-forum.com (Daniel Zepeda) Date: Fri, 24 Apr 2009 03:34:53 +0200 Subject: [wxruby-users] Drag and Drop help Message-ID: <2c158f4df31caf4cee10ffe3c2904fc0@ruby-forum.com> Hello Folks, I notice that the 'Drag and Drop Overview' link in the documentation is broken. My goal is to drag an image over another, larger image and have it snap in place in a particular area of the larger image when dropped, which also generates an event for further processing. I'm having a bit of trouble getting started with that, especially since there doesn't seem to be an available overview. I've seen the samples, but they aren't quite what I'm after. Any pointers are appreciated. Thanks! DZ -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri Apr 24 07:37:06 2009 From: alex at pressure.to (Alex Fenton) Date: Fri, 24 Apr 2009 12:37:06 +0100 Subject: [wxruby-users] Drag and Drop help In-Reply-To: <2c158f4df31caf4cee10ffe3c2904fc0@ruby-forum.com> References: <2c158f4df31caf4cee10ffe3c2904fc0@ruby-forum.com> Message-ID: <49F1A462.6020907@pressure.to> Hi Daniel Zepeda wrote: > I notice that the 'Drag and Drop Overview' link in the documentation is > broken. My goal is to drag an image over another, larger image and have > it snap in place in a particular area of the larger image when dropped, > which also generates an event for further processing. > > I think the approach here is to define your own subclass of Wx::DropTarget which holds a BitmapDataObject. In this subclass you supply your own on_drop or on_data methods, which receive the (x,y) co-ordinates where the drop took place. You would then do appropriate calculations to "snap" the image into wherever it should go. See the events.rb sample for an illustration of how to generate your own custom event types and send them for processing (using process_event). For the source side, you'll probably want Wx::DropSource, this should be more straightforward. If you want a live animation of the image being dragged, there is a pre-built class for this, Wx::DragImage. A simple example of its use is demonstrated in bigdemo.rb. > I'm having a bit of trouble getting started with that, especially since > there doesn't seem to be an available overview. See also the wxWidgets drag and drop overview: http://docs.wxwidgets.org/stable/wx_wxdndoverview.html a From alex at pressure.to Wed Apr 29 13:14:13 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 29 Apr 2009 18:14:13 +0100 Subject: [wxruby-users] Image in Title Bar In-Reply-To: References: <43397c700904251009m7b055370qf259882290928d47@mail.gmail.com> Message-ID: <49F88AE5.7090104@pressure.to> Jason Shelton wrote: > Thanks for the response. Can you now tell me how to display an image > on a frame and/or window, and set the size and position of the image? > Thanks in advance for all assistance. As well as Dix's advice about using Wx::Image to size images, see also the documentation for DC (Device Context, which handles all drawing on screen), and Bitmap. There's a number of relevant samples in samples/drawing which show how to display an image on a Window. a From alex at pressure.to Wed Apr 29 17:29:33 2009 From: alex at pressure.to (Alex Fenton) Date: Wed, 29 Apr 2009 22:29:33 +0100 Subject: [wxruby-users] Image in Title Bar In-Reply-To: References: <43397c700904251009m7b055370qf259882290928d47@mail.gmail.com> <49F88AE5.7090104@pressure.to> Message-ID: <49F8C6BD.6070804@pressure.to> Jason Shelton wrote: > I can get the image on the window, but I cannot get it to show on a > panel. Is this possible? If so, how? Thanks again. Yes it is possible, the method is the same. What have you tried? alex