paul.allton@uk.bnpparibas.com
2006-Dec-14 10:45 UTC
wxruby2-preview Gauge and wx-sugar with SplitterWindow
First of all, just wanted to say big thanks for all the great work on wxruby2 .. I''ve been a user of 0.6 for a long time and its proved very useful over the years. It''s great to finally have a multi-platform, gem installable ui toolkit that doesn''t suck! Secondly, thanks also for wx-sugar. I was drowning in sizers and started to write my own layout library ... but yours is likely to be far better so I''ve ditched mine and I''m using sugar from now on. However, I have a couple of issues ... (in both cases, apologies if I''m just not using it correctly) (1) setting foreground and background colours on a Gauge. - on wxruby2-preview (0.0.36) windows, the colours seem to be ignored, i.e. no matter what you change it to, its always blue on grey. - on wxruby2-preview (0.0.37) OS X, the background does change but not the foreground - is this an OS restriction? i.e. is the bar always blue in OS X? (2) expanding SplitterWindow''s content in wx-sugar Basically, I need a SplitterWindow with a ListBox and a TextCtrl, the following snippet creates just that, but the contained controls do not expand to fit the splitter''s panels (they just appear small). I''ve tried setting the minsize and proportion when adding them to the panel, i.e @errors = p1.add(ListBox.new(p1), :minsize => true), but then they just disappear altogether. Where am going wrong? arrange_vertically splitter = SplitterWindow.new(self) splitter.minimum_pane_size = 10 p1 = splitter.add(Panel.new(splitter)) do | p1 | @errors = p1.add(ListBox.new(p1)) end p2 = splitter.add(Panel.new(splitter)) do | p2 | @log = p2.add(TextCtrl.new(p2, :style => TE_MULTILINE | TE_READONLY)) end splitter.split_horizontally(p1, p2) add(splitter, :proportion => 1) Many thanks, Paul This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
Alex Fenton
2006-Dec-15 01:32 UTC
[Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow
Hi Paul> (1) setting foreground and background colours on a Gauge. > - on wxruby2-preview (0.0.36) windows, the colours seem to be ignored, > i.e. no matter what you change it to, its always blue on grey. > - on wxruby2-preview (0.0.37) OS X, the background does change but not > the foreground - is this an OS restriction? i.e. is the bar always > blue in OS X?I''m not so sure for Windows, but certainly on OS X I would be very surprised if you were allowed to change the colour of the Aqua-style gauge. Underneath wxruby it''s implemented by calls to the standard API and from Apple''s interface builder there''s no setting to alter this colour. I''d probably see this as a platform-native feature - maybe have another look at what you''re trying to convey by using a non-standard gauge colour. Perhaps we could suggest a more familiar UI metaphor?> (2) expanding SplitterWindow''s content in wx-sugar > Basically, I need a SplitterWindow with a ListBox and a TextCtrl, the > following snippet creates just that, but the contained controls do not > expand to fit the splitter''s panels (they just appear small). I''ve > tried setting the minsize and proportion when adding them to the > panel, i.e @errors = p1.add(ListBox.new(p1), :minsize => true), but > then they just disappear altogether. Where am going wrong?You are telling the splitter window to expand within the frame, by using :proportion => 1 at the end, but you also need to tell the ListBox and TextCtrl to expand within their containing Panels. Otherwise they will appear at the small default size. eg: arrange_vertically splitter = SplitterWindow.new(self) splitter.minimum_pane_size = 10 p1 = splitter.add(Panel) do | p1 | # arrange ... p1.arrange_vertically do # ... and expand @errors = p1.add(ListBox, :proportion => 1) end end p2 = splitter.add(Panel) do | p2 | # ditto p2.arrange_vertically do log_style = TE_MULTILINE|TE_READONLY @log = p2.add(TextCtrl[:style => log_style], :proportion => 1) end end splitter.split_horizontally(p1, p2) add(splitter, :proportion => 1) I ''sugared'' your code generally to illustrate that you can just use the class name (or klass[]) within a call to ''add'' because the parent is implied. But only the calls to arrange_vertically and the :proportion=> 1 arguments actually needed for your purpose. cheers alex
paul.allton at uk.bnpparibas.com
2006-Dec-18 15:31 UTC
[Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow
Hi Alex, Thanks for the quick response ...> I''m not so sure for Windows, but certainly on OS X I would be very > surprised if you were allowed to change the colour of the Aqua-style > gauge. Underneath wxruby it''s implemented by calls to the standard API > and from Apple''s interface builder there''s no setting to alter thiscolour.> I''d probably see this as a platform-native feature - maybe have another > look at what you''re trying to convey by using a non-standard gauge > colour. Perhaps we could suggest a more familiar UI metaphor?You can definitely change the gauge background/foreground colours in windows wxruby 0.6.0, but not in wxruby2preview. For OS X, I agree that it goes against the apple UI guidelines and so seems reasonable not to work. I also agree that its probably not the right UI metaphor and have subsequently ditched the gauge. I''m basically trying to implement a solid red/green status bar, like junit (http://www.junit.org/). Following advice from the OS X junit (see: http://java.sun.com/developer/technicalArticles/JavaLP/JavaToMac2/), I''ve since tried to implement this using a TextCtrl. This works fine on windows, but on OS X the background is always white. Should this work, or can you suggest another component type that can be coloured in this way?> You are telling the splitter window to expand within the frame, by using> :proportion => 1 at the end, but you also need to tell the ListBox and >TextCtrl to expand within their containing Panels. Otherwise they will > appear at the small default size. eg: .....(snip) Thanks for the arrangement advice, this works just great now. Also, I didn''t know about the ability to just use the class name, that''s really nice. I''d hate to have to write a UI without wx-sugar now ;) A couple more questions for you ... - TextCtrl on windows supports the TE_RICH and TE_AUTO_URL styles, but I cannot seem to extract the url from the generated evt_text_url event. Is this not supported or am I just not asking the right question of it? - I''m a big fan of automated UI testing (i.e. driving the UI from some robot API). I appreciate this is potentially a whole new project, but does wxwidgets provide a method of clicking buttons, typing into components ... if so, would it be technically possible to expose this in wxruby. Cheers, Paul This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061218/78b0ae25/attachment-0001.html
Alex Fenton
2006-Dec-18 17:15 UTC
[Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow
Hi Paul> You can definitely change the gauge background/foreground colours in > windows wxruby 0.6.0, but not in wxruby2preview.OK, I didn''t know that. Feel free to file a bug for it.> I also agree that its probably not the right UI metaphor and have > subsequently ditched the gauge. I''m basically trying to implement a > solid red/green status bar,I wondered if it was something like that. Eclipse + RDT uses it for the unit testing runner. I actually think it reasonable UI device but unfortunately as the link you sent points out it''s a Swing thing.> I''ve since tried to implement this using a TextCtrl. This works fine > on windows, but on OS X the background is always white. Should this > work, or can you suggest another component type that can be coloured > in this way?Are you using set_background_colour or set_default_style? I know that set_style doesn''t respect the background colour of a TextAttr on OS X, on 10.3 at least. My investigations suggest that WxWidgets wraps different native OS X controls on different versions, including one that doesn''t support bg colour on text. This is a thorn in my side as I need this for an app - so it''s something I''m pursuing. In the meantime, possible workarounds might be to place StaticText on a Panel (which definitely can be coloured on OS X), or (really nasty) to use a single-cell Grid and hide the column and row headers.> A couple more questions for you ...I''ll reply in new threads... Alex
paul.allton at uk.bnpparibas.com
2006-Dec-20 11:26 UTC
[Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow
> OK, I didn''t know that. Feel free to file a bug for it.Done ... #7386>I wondered if it was something like that. Eclipse + RDT uses it for the >unit testing runner. I actually think it reasonable UI device but >unfortunately as the link you sent points out it''s a Swing thing.:)>Are you using set_background_colour or set_default_style? I know that >set_style doesn''t respect the background colour of a TextAttr on OS X, >on 10.3 at least.I''m using set_background_colour...>In the meantime, possible workarounds might be to place StaticText on a >Panel (which definitely can be coloured on OS X), or (really nasty) to >use a single-cell Grid and hide the column and row headers.I''ve tried the Panel option and whilst its definitely colour-able its causing some other problems in my app. I''ll try and create a simple test case before elaborating further on that, and I''d also like to test it on the new 0.0.38 build. The Grid option does sound rather nasty, but I''ll give it a go ... - how do I hide the column/row headers? - how can I make the single cell grow to fit the entire grid space? - I''d prefer to use the TextCtrl on windows and whatever works on OSX, is there some way to establish at runtime which platform the app is running on? This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061220/f4d37d99/attachment.html
Alex Fenton
2006-Dec-20 12:24 UTC
[Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow
Hi> The Grid option does sound rather nasty, but I''ll give it a go ...Haven''t tested the below today, but from memory:> > - how do I hide the column/row headers?set_col_label_size(0) set_row_label_size(0)> - how can I make the single cell grow to fit the entire grid space?set_col_size(0, get_size[0])> - I''d prefer to use the TextCtrl on windows and whatever works on OSX, > is there some way to establish at runtime which platform the app is > running on?Test the value of Wx::PLATFORM - should be one of ''WXMSW'', ''WXGTK'', ''WXMAC'' cheers alex