List Info

Thread: Re: I'm working on my graphics window for the ruby quiz




Re: I'm working on my graphics window for the ruby quiz
user name
2007-03-11 07:08:04
On 3/10/07, Raj Sahae <rajsahaegmail.com> wrote:

> And I have no idea how to get this canvas working.
> I've been looking at the scribble.rb example and trying
to work off that.
>
> This is my display method, I get a seg fault when I run
the method.
>
>   def display
>     FXDCWindow.new(canvas) do |dc|
>       torus.grid.each_with_index do |row, y|
>         row.each_with_index do |part, x|
>           if part == :vapor
>             dc.foreground = "blue"
>             dc.drawPoint(x, y)
>           elsif part == :vacuum
>             dc.foreground = "black"
>             dc.drawPoint(x, y)
>           elsif part == :ice
>             dc.foreground = "gray"
>             dc.drawPoint(x, y)
>           end
>         end
>       end
>     end
>   end

I don't see anything that is obviously wrong with it. It
might help to
see the problem in context, though (i.e. in a complete
program).
_______________________________________________
fxruby-users mailing list
fxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/fxruby-users

Re: I'm working on my graphics window for the ruby quiz
user name
2007-03-11 19:29:09
hi there,
my experience with the  !$§%&-FXDCWindow and
many other Widgets in
FXRuby is, that they easily segfault if you pass nil as a
param to a
method that does expect some pointer to a widget. for
instance in your
code make sure that canvas is not nil and that any other
parameters.... you pass to the widgets are not nil and are
of the
expected type as stated by the API reference docs!

PS: with fxdcwindow you can easily get segfaults when using
the method
to draw text without defining a standard font. also using a
font that
has not been created will segfault.
now you know the reason for me heavily cursing on FXDCWindow
;)

-- henon

On 3/11/07, Lyle Johnson <lyle.johnsongmail.com> wrote:
> On 3/10/07, Raj Sahae <rajsahaegmail.com> wrote:
>
> > And I have no idea how to get this canvas
working.
> > I've been looking at the scribble.rb example and
trying to work off that.
> >
> > This is my display method, I get a seg fault when
I run the method.
> >
> >   def display
> >     FXDCWindow.new(canvas) do |dc|
> >       torus.grid.each_with_index do |row, y|
> >         row.each_with_index do |part, x|
> >           if part == :vapor
> >             dc.foreground = "blue"
> >             dc.drawPoint(x, y)
> >           elsif part == :vacuum
> >             dc.foreground = "black"
> >             dc.drawPoint(x, y)
> >           elsif part == :ice
> >             dc.foreground = "gray"
> >             dc.drawPoint(x, y)
> >           end
> >         end
> >       end
> >     end
> >   end
>
> I don't see anything that is obviously wrong with it.
It might help to
> see the problem in context, though (i.e. in a complete
program).
> _______________________________________________
> fxruby-users mailing list
> fxruby-usersrubyforge.org
> ht
tp://rubyforge.org/mailman/listinfo/fxruby-users
>
_______________________________________________
fxruby-users mailing list
fxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/fxruby-users

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )