Displaying 20 results from an estimated 30 matches for "evt_paint".
2007 Dec 01
5
Tearing in my buffered animation test script...
...class MyApp < Wx::App
def on_init
#Containing frame.
frame = Wx::Frame.new(nil, :size => [300, 300])
frame.show
#Offscreen drawing buffer.
buffer = Wx::Bitmap.new(300, 300)
#Displays drawing.
window = Wx::Window.new(frame, :size => [300, 300])
window.evt_paint do |event|
window.paint do |dc|
#Copy the buffer to the viewable window.
buffer.draw do |buffer_dc|
dc.blit(0, 0, 300, 300, buffer_dc, 0, 0)
end
end
end
#Animate.
(1..40).each do |i|
#Clear screen.
buffer.draw do |surface|...
2007 Mar 21
4
Problem with PaintDC(MSW)
When implementing EVT_PAINT handlers in c++ the PaintDC object is
constructed at the beginning of the function,
and auto destructed at it''s end, which informs wxwidgets that "invalid
regions in the window have been repainted".
Under ruby, this is not the case and causes a stream of EVT_PAINT events
to be...
2008 Jan 02
3
how can I use draw line in wxruby??
I use
dc = DC.new()
dc.draw_line(50, 50, 100, 100)
but it can''t be compiled
I don''t know how to declare DC variable??
in http://wxruby.rubyforge.org/doc/dc.html
it don''t tell me how to declare now variable
plese tell me :''(
--
Posted via http://www.ruby-forum.com/.
2007 Apr 29
0
[983] branches/wxruby2/wxwidgets_282: Make Window#paint work both inside and outside a paint event handler,
...t;>@@ -21,4 +21,18 @@
</span><span class="cx"> def find_window_by_label(a_label)
</span><span class="cx"> Wx:Window.find_window_by_label(a_label, self)
</span><span class="cx"> end
</span><ins>+
+ alias :__old_evt_paint :evt_paint
+ # This modified version of evt_paint sets a variable indicating that a
+ # paint event is being handled just before running the event
+ # handler. This ensures that any call to Window#paint within the
+ # handler will supply a Wx::PaintDC (see swig/Window.i).
+ def evt_paint(&...
2007 Apr 29
0
[991] branches/wxruby2/wxwidgets_282/doc/textile: Update documentation for painting methods and WindowDC subclasses
...st be constructed if an application wishes to paint on the
-client area of a window from outside an *OnPaint* event.
-This should normally be constructed as a temporary stack object; don''t store
-a ClientDC object.
</del><ins>+This class is used to draw upon Windows outside of @evt_paint@
+handlers. It is not instantiated directly; rather, call the
+"paint":window.html#Window_paint method of the Window you wish to draw
+upon, and pass a block which will receive a ClientDC object.
</ins><span class="cx">
</span><del>-To draw on a window f...
2007 Apr 29
0
[993] branches/wxruby2/wxwidgets_282/samples/bigdemo/wxScrolledWindow.rbw: Use ClientDC via Window#paint object
...down {|event| on_left_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>&l...
2006 Oct 23
0
[709] trunk/wxruby2/samples/dialogs/dialogs.rb: Use paint method again, remove unnecessary global (Alex Fenton)
...ON_RESIZE)
</span><del>- text = Wx::StaticText.new(self, -1,
- ''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">...
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
2007 Dec 30
4
Drawing thread not getting enough time from scheduler?
Need some assistance with animation again... When I run the drawing
code in a separate thread, it''s slow as heck. I think it may be
because the drawing thread isn''t getting enough time from the thread
scheduler.
I was able to reproduce the problem in my little sample program simply
by increasing the number of lines it draws per update. I''m lucky to
get one frame
2005 Jan 22
9
Dragging images across the canvas
...o
#################
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...
2008 Jan 19
5
No joy from Wx::App.dispatch, Wx::App.yield...
...Wx::App
def on_init
#Containing frame.
frame = Wx::Frame.new(nil, :size => [300, 300])
frame.show
#Offscreen drawing buffer.
buffer = Wx::Bitmap.new(300, 300)
#Displays drawing.
window = Wx::Window.new(frame, :size => [300, 300])
window.evt_paint do |event|
update_window(window, buffer)
end
#Initialize drawing loop counter.
@i = 0
#Animate periodically.
timer_id = Wx::ID_HIGHEST + 1
t = Wx::Timer.new(self, timer_id)
evt_timer(timer_id) do
animate(window, buffer)
#No effect....
2007 Sep 29
0
[ wxruby-Bugs-14322 ] Multiple warnings, especially @__painting__
...22&group_id=35
Category: Incorrect behavior
Group: current
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: Multiple warnings, especially @__painting__
Initial Comment:
Hi,
I''m drawing with "paint" outside the normal evt_paint with the following code (just as example) in a subclass of Wx::Panel:
paint do |dc|
dc.draw_circle( ... )
end
With this I get multiple "warning: instance variable @__painting__ not initialized" warnings for each paint call.
Because they are displayed on every draw event, developing w...
2007 Mar 03
0
[ wxruby-Bugs-9004 ] Painting Problems on Windows
...t in a scrolled window myself but it occurs in all painting events I believe. I''m using the wxRuby2 preview release (0.0.38). I''m mostly using wxRuby on a Mac and Windows and the problem has only occurred on Windows.
Essentially once you send a refresh command to a control with a evt_paint handler it seems to go into a loop whereby the control is constantly told to repaint itself. This generally causes a quick crash due to the garbage collection problems on Windows but if you disable the garbage collection you get the issue I describe.
I''ve attached some sample code that il...
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/.
2007 Oct 04
1
wxRuby: MemoryDC problems...
...raise
end
end
class MyApp < Wx::App
def on_init
#Create the top window.
frame = Wx::Frame.new(nil, :size => [300, 300])
#Create a panel within it.
view = Wx::Window.new(frame)
buffer = Wx::Bitmap.new(300, 300)
@x = 0
#Set up a handler for paint events.
view.evt_paint do |event|
#Wx::Window#paint takes a block.
#This will later be called with a device context to paint on.
view.paint do |dc|
buffer.draw do |buffer_dc|
buffer_dc.clear
buffer_dc.pen = Wx::Pen.new(Wx::Colour.new(128, 128, 128), 5)
buffer_dc.draw_line(@x, 0, @x + 100, 100)...
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
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 Apr 22
0
wxruby-swig 0.0.4
...orgotten all about it. There may be other
features that we manually added to wxRuby that I will need to be
reminded about so I can add them to the new codes base as well.
This new release of wxruby-swig adds the same Window#paint method, which
required me to implement DC, WindowDC, PaintDC, and evt_paint.
Continuing the pattern, I had some obstacles, but was able to find
solutions for all of them.
The wxWidgets reference docs, which I am using to build all the class
definitions, do not specify whether a method is "pure virtual" or not.
SWIG requires this information to behave correct...
2004 Feb 02
0
the sample
...//hu.php.net --+
-------------- 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,'&...
2003 Nov 25
1
Does wxRuby have event masks or something similar?
I''m trying to capture character events on a frame, using the following
piece of
code (adapted from samples/etc/test.rb):
def initialize(title)
super(nil, -1, title, Wx::Point.new(-1,-1), Wx::Size.new(530,590),
Wx::DEFAULT_FRAME_STYLE | Wx::FRAME_SHAPED)
evt_paint { onPaint }
evt_char { | evt |
puts "Got char evt: "+evt.to_s
if evt.get_key_code.chr =~ /\s/
next_image
end
}
@bitmap = nil
@file = nil
end
(I''ve added the constant for Wx::FRAME_SHAPED to try and allow resizing
programtically. Doesn'&...