Displaying 20 results from an estimated 28 matches for "on_paint".
2006 Sep 29
5
ObjectPreviouslyDeleted when trying to paint
Hi,
I''m running into something along the lines of bug 5383. I''m hoping I''m
doing something obviously wrong and that someone can point me in the
right direction.
I''ve got a custom paint event handler:
def on_paint
puts "mainframe on_paint"
paint do |dc|
dc.clear
@cl.draw dc
end
end
Then I''ve got a key press handler that changes @cl and calls refresh
on the frame to get it to redraw. Without calling refresh, things seem
to be fine. (Although obviously my app doesn...
2006 Nov 13
0
[739] trunk/wxruby2/samples/dialogs/dialogs.rb: Changed back to using block version of paint in on_paint method.
...on: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>[739] trunk/wxruby2/samples/dialogs/dialogs.rb: Changed back to using block version of paint in on_paint method.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>739</dd>
<dt>Author</dt> <dd>seanlong</dd>
<dt>Date</dt> <dd>2006-11-13 17:32:58 -0500 (Mon, 13 Nov 2006)</dd>
&l...
2006 Sep 21
1
on_paint nightmare
I was trying out the RMagick sample from the wiki and ran into an
interesting(?) problem: If you resized the window it got stuck in an
endless loop calling onPaint. After a bit, if you had the mouse in the
window it would crash. Anyone seen this behavior before? I wonder if
this is related to other crashes we''ve seen?
Roy
2007 Apr 29
0
[993] branches/wxruby2/wxwidgets_282/samples/bigdemo/wxScrolledWindow.rbw: Use ClientDC via Window#paint object
...ft_button_event_down(event)}
</span><span class="cx"> evt_left_up {|event| on_left_button_event_up(event)}
</span><span class="cx"> evt_motion {|event| on_left_button_event_motion(event)}
</span><del>- evt_paint {|event| on_paint(event)}
</del><ins>+ evt_paint { on_paint }
</ins><span class="cx"> #evt_mousewheel {|event| on_wheel(event)}
</span><span class="cx"> end
</span><span class="cx">
</span><del>- def...
2007 Jan 09
6
help w/push_event_handler plus doc update request
...ass TinyApp < Wx::App
def on_init
frame = MainFrame.new("painter")
setup_frame(frame)
frame.show()
end
def setup_frame(frame) # setup my application''s stuff here
frame <----.push_event_handler here---->
class << frame
def on_paint
puts ("handling on_paint")
end #end on_paint
end #end class<<frame
end #end setup_frame
end #end TinyApp
TinyApp.new.main_loop
-----------------
2008 Jan 14
15
How to get a Window handle from another app?
Hello,
I would like to get a window handle from another app outside of wxRuby
and convert it into a wxRuby Window handle so that I can use it as the
parent Window for several wxRuby child windows. Basically I want to use
the FRAME_FLOAT_ON_PARENT window style so that my wxRuby windows become
associated with the outside app kind of like toolbars, e.g., they don''t
show up in the
2005 Jan 22
9
Dragging images across the canvas
...####
require ''wxruby''
class MyFrame < Wx::Frame
def initialize(title)
super(nil, -1, title,Wx::DEFAULT_POSITION, Wx::Size.new(250,250))
image = Wx::Image.new("sk.png")
@bitmap = Wx::Bitmap.new(image)
@left_dn = false
evt_paint { on_paint }
evt_motion {|event| on_motion(event) }
evt_left_down {|event| @left_dn = true }
evt_left_up {|event| @left_dn = false }
end
def move_region(nx,ny)
ox,oy,w,h = @reg.get_box
@reg.clear
@reg = Wx::Region.new(nx,ny,nx+w,ny+h)
dc = Wx::ClientDC.new(...
2006 Nov 13
7
[736] trunk/wxruby2/samples/dialogs/dialogs.rb: Fixed crashing bug in on_paint and made the code style more Ruby like.
...kground:#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>[736] trunk/wxruby2/samples/dialogs/dialogs.rb: Fixed crashing bug in on_paint and made the code style more Ruby like.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>736</dd>
<dt>Author</dt> <dd>seanlong</dd>
<dt>Date</dt> <dd>2006-11-13 03:31:06 -0500...
2006 Oct 21
6
Window#paint patch
Attached is a patch and some extra files to fix our
ObjectPreviouslyDeleted crasher with the paint method. As discussed, it
just re-implements the method in Ruby.
I created a directory lib/wx/classes as a place to hold Ruby extensions
to the API. The attached app.rb and window.rb files should be added to
it. When this patch is applied, files in that directory are
automatically required on
2004 Aug 03
1
Drawing
Anyone know how to draw in wxRuby? I want to draw a graph, and have
it update as new data comes in. I see stuff about Device Contexts,
but I can''t find anything about how to use them, associate them with a
panel, or anything like that.
-Kurt
2004 Feb 02
0
the sample
...------------- next part --------------
#!/usr/bin/ruby
require ''wxruby''
include Wx
class MyImageFrame < Dialog
def initialize parent, title, bmap
super(parent, -1, title)
@bitmap=bmap
set_client_size_wh(@bitmap.get_width,@bitmap.get_height)
evt_paint {|what| on_paint(what)}
evt_left_down {on_click()}
end
def on_click
close
end
def on_paint what
dc = PaintDC.new(self)
dc.draw_bitmap(@bitmap,0,0,true)
end
end
class MyFrame < Wx::Frame
def initialize(title)
super(nil, -1, title)
b=Button.new(self,-1,''e'')...
2004 Jun 22
8
Tracking Mouse motion
Skipped content of type multipart/alternative-------------- next part --------------
A non-text attachment was scrubbed...
Name: tst_wxPaint.rbw
Type: application/octet-stream
Size: 4446 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20040622/abc8ba85/tst_wxPaint-0001.obj
2006 Aug 10
3
update on samples
...endar.rb
OK
- caret.rb
OK - but arrow keys don''t work properly (should they?)
- controls.rb
Seems OK, except doesn''t work if not run from current dir. Probably
should add textctrls to this one.
- dialogs.rb
Problems with DC - seems to cause ObjectPreviouslyDeleted error in an
on_paint handler. I have worked round this. MDI, ColourDialog crashes on
OS X.
- system_settings.rb
OK (thanks to Sean''s fix for get_text_extent)
- images.rb
OK
- listbook.rb
OK, except breaks if not run from own directory.
- mdi.rb
MDI doesn''t work on OS X?
- minimal.rb
OK - have ti...
2006 Oct 23
0
[709] trunk/wxruby2/samples/dialogs/dialogs.rb: Use paint method again, remove unnecessary global (Alex Fenton)
...''WxRuby common dialog test application'',
- Wx::Point.new(10, 10) )
- # PaintDC currently causing ObjectPreviouslyDeleted (10 Aug 2006)
- # evt_paint() {|event| onPaint(event) }
</del><ins>+ evt_paint { |event| on_paint(event) }
</ins><span class="cx"> end
</span><span class="cx">
</span><span class="cx"> def clear
</span><span class="cx">
</span><span class="cx"> end
</span><span class=&q...
2007 Nov 18
4
set background label to transparent??
I just use wxRuby and I have problem
I use background image on my app and when I create label it seem look
background of label is gray, how can I change it into transparent????
--
Posted via http://www.ruby-forum.com/.
2004 Jan 08
3
pictorG
...class MyImageFrame < Dialog # -- opens a dialog to show a picture
def initialize parent, title, filename
super(parent, -1, title)
@bitmap=Bitmap.new(filename,BITMAP_TYPE_ANY) # why should I say BITMAP_TYPE_ANY?
set_client_size_wh(@bitmap.get_width,@bitmap.get_height)
evt_paint {on_paint()}
evt_left_down {on_click()}
end
def on_click
@bitmap.destroy()
self.destroy()
end
def on_paint
dc = PaintDC.new(self)
dc.draw_bitmap(@bitmap,0,0,true)
end
end
class Pictures < ListCtrl # -- show the pictures
def initialize parent
super parent,-1,DEFAULT_P...
2007 May 04
0
[1005] trunk/wxruby2/samples/images/images.rb: Remove some debugging output
...p;nbsp    2007-05-04 20:02:44 UTC (rev 1005)
</span><span class="lines">@@ -30,12 +30,10 @@
</span><span class="cx"> end
</span><span class="cx">
</span><span class="cx"> def on_paint
</span><del>- puts("onPaint begin")
</del><span class="cx"> paint do | dc |
</span><span class="cx"> dc.clear
</span><span class="cx"> dc.draw_bitmap(@bitmap, 0, 0, false)
</span><spa...
2007 Apr 29
0
[980] branches/wxruby2/wxwidgets_282/samples/bigdemo/ShapedWindow.rbw: Use Window#paint instead of PaintDC.new
...     2007-04-29 00:02:02 UTC (rev 980)
</span><span class="lines">@@ -65,8 +65,7 @@
</span><span class="cx"> end
</span><span class="cx">
</span><span class="cx"> def on_paint
</span><del>- dc = PaintDC.new(self)
- dc.draw_bitmap(@bmp, 0, 0, true)
</del><ins>+ paint { | dc | dc.draw_bitmap(@bmp, 0, 0, true) }
</ins><span class="cx"> end
</span><span class="cx">
</span><span class...
2007 Apr 28
0
[979] branches/wxruby2/wxwidgets_282/lib/wx/classes/paintdc.rb: Prevent dangerous direct instantiation of PaintDC
...rev 0)
+++ branches/wxruby2/wxwidgets_282/lib/wx/classes/paintdc.rb        2007-04-28 23:56:32 UTC (rev 979)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+# Device Context to paint within an on_paint handler
+class Wx::PaintDC
+ # This class should not be instantiated directly in wxRuby; it should
+ # always be used via Window#paint, which takes a block receiving the
+ # DC. This ensures that the DC is cleaned up at the correct time,
+ # preventing serious errors on some platforms.
+ def i...
2007 Apr 29
0
[984] branches/wxruby2/wxwidgets_282/lib/wx/classes/clientdc.rb: Prevent dangerous direct instantiation of ClientDC
...nches/wxruby2/wxwidgets_282/lib/wx/classes/clientdc.rb        2007-04-29 13:34:50 UTC (rev 984)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+# Device Context to paint on a window outside an on_paint handler. It is
+# recommended that PaintDC is used in preference to this class.
+class Wx::ClientDC
+ # This class should not be instantiated directly in wxRuby; it should
+ # always be used via Window#paint, which takes a block receiving the
+ # DC. This ensures that the DC is cleaned up at the...