nobody at rubyforge.org
2006-Oct-19 16:48 UTC
[Wxruby-development] [690] trunk/wxruby2/samples/text/unicode.rb: Placed controls within a panel so they appear on the correct themed background
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type"
content="text/html; charset=utf-8" /><style
type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:'':'';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family:
verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;
font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding:
6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid;
padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family:
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch
.binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[690] trunk/wxruby2/samples/text/unicode.rb: Placed controls within
a panel so they appear on the correct themed background</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>690</dd>
<dt>Author</dt> <dd>brokentoy</dd>
<dt>Date</dt> <dd>2006-10-19 12:48:19 -0400 (Thu, 19 Oct
2006)</dd>
</dl>
<h3>Log Message</h3>
<pre>Placed controls within a panel so they appear on the correct themed
background
colour on Windows; remove now-unneeded alias; update info text; show
something in the Choice control (Alex Fenton)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a
href="#trunkwxruby2samplestextunicoderb">trunk/wxruby2/samples/text/unicode.rb</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwxruby2samplestextunicoderb"></a>
<div class="modfile"><h4>Modified:
trunk/wxruby2/samples/text/unicode.rb (689 => 690)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/samples/text/unicode.rb        2006-10-19
09:07:56 UTC (rev 689)
+++
trunk/wxruby2/samples/text/unicode.rb        2006-10-19
16:48:19 UTC (rev 690)
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> class UnicodeDemoTextCtrl <
Wx::TextCtrl
</span><span class="cx"> NEWLINE_CORRECTION_FACTOR = 0
</span><span class="cx">
</span><del>- DEFAULT_TEXT = "This sample requires that you
have a unicode build of WxWidgets. If you do, you should be able to see a range
of characters from different languages displayed, and be able to type
multilingual strings in the text area. Note that some characters may only be
displayed if you are using a suitable font.
</del><ins>+ DEFAULT_TEXT = "If you have a unicode version of
wxruby, you should be able to see a range of characters from different languages
displayed, and be able to type multilingual strings in the text area. Note that
some scripts may only be displayed if you are using a suitable font; otherwise
characters will appear as blank boxes.
</ins><span class="cx">
</span><span class="cx"> " << File.read(
$utf8_file )
</span><span class="cx">
</span><span class="lines">@@ -24,9 +24,6 @@
</span><span class="cx"> Wx::DEFAULT_POSITION,
Wx::DEFAULT_SIZE, Wx::TE_MULTILINE)
</span><span class="cx"> end
</span><span class="cx">
</span><del>- # more ruby-ish
- alias :<< :append_text
-
</del><span class="cx"> # run through a few useful
methods of textctrl and report the results
</span><span class="cx"> # as a string
</span><span class="cx"> def report()
</span><span class="lines">@@ -66,36 +63,38 @@
</span><span class="cx">
</span><span class="cx"> def initialize(title, pos,
size)
</span><span class="cx"> super(nil, -1, title, pos,
size)
</span><ins>+ panel = Wx::Panel.new(self)
</ins><span class="cx"> sizer =
Wx::BoxSizer.new(Wx::VERTICAL)
</span><span class="cx">
</span><span class="cx"> # The text input and display
</span><del>- @textctrl = UnicodeDemoTextCtrl.new(self)
</del><ins>+ @textctrl = UnicodeDemoTextCtrl.new(panel)
</ins><span class="cx"> sizer.add(@textctrl, 3,
Wx::GROW|Wx::ALL, 2)
</span><span class="cx">
</span><span class="cx"> # The button to show
what''s selected
</span><del>- button = Wx::Button.new(self, -1,
''Describe text selection'')
</del><ins>+ button = Wx::Button.new(panel, -1,
''Describe text selection'')
</ins><span class="cx"> sizer.add(button, 0,
Wx::ADJUST_MINSIZE|Wx::ALL, 2 )
</span><span class="cx"> evt_button(button.get_id) { |
e | on_click(e) }
</span><span class="cx">
</span><del>- @log = LogTextCtrl.new(self)
</del><ins>+ @log = LogTextCtrl.new(panel)
</ins><span class="cx"> sizer.add(@log, 1,
Wx::GROW|Wx::ALL, 2)
</span><del>- sizer.add( Wx::StaticText.new(self, -1,
''Some controls with unicode''),
</del><ins>+ sizer.add( Wx::StaticText.new(panel, -1,
''Some controls with unicode''),
</ins><span class="cx"> 0,
Wx::ADJUST_MINSIZE|Wx::ALL, 2 )
</span><span class="cx"> ctrl_sizer =
Wx::BoxSizer.new(Wx::HORIZONTAL)
</span><span class="cx">
</span><del>- test_button = Wx::Button.new(self, -1,
''万'')
</del><ins>+ test_button = Wx::Button.new(panel, -1,
''万'')
</ins><span class="cx"> ctrl_sizer.add(test_button, 0,
Wx::ADJUST_MINSIZE|Wx::ALL, 2)
</span><del>- choice = Wx::Choice.new(self, -1,
Wx::DEFAULT_POSITION,
</del><ins>+ choice = Wx::Choice.new(panel, -1,
Wx::DEFAULT_POSITION,
</ins><span class="cx">
Wx::DEFAULT_SIZE, [])
</span><span class="cx">
File.readlines($utf8_file).each do | line |
</span><span class="cx"> next if line.chomp.empty?
</span><span class="cx"> choice.append(line.chomp)
</span><span class="cx"> end
</span><ins>+ choice.set_selection(0)
</ins><span class="cx"> ctrl_sizer.add(choice, 0,
Wx::ADJUST_MINSIZE|Wx::ALL, 2)
</span><span class="cx">
</span><span class="cx"> sizer.add(ctrl_sizer, 0,
Wx::ADJUST_MINSIZE|Wx::ALL, 2)
</span><span class="cx"> construct_menus()
</span><del>- self.set_sizer( sizer )
</del><ins>+ panel.set_sizer( sizer )
</ins><span class="cx"> end
</span><span class="cx">
</span><span class="cx"> # Prompt the user to specify a
file whose contents should be loaded
</span></span></pre>
</div>
</div>
</body>
</html>
Maybe Matching Threads
- [691] trunk/wxruby2/samples/calendar/calendar.rb: Placed controls within a panel so they appear on the correct themed background
- Choosing a Sizer
- [1139] trunk/wxruby2/samples/text/textctrl.rb: Place TextCtrl sample in a panel so gets correct bg color on MSW
- [809] trunk/wxsugar/lib/wx_sugar/layout.rb: Fix default sizers to arrange_vertically, add padding on specified sides
- [749] trunk/wxruby2: Bring the documentation and actual method support into line for
