|
From: Takaaki T. <tt...@kt...> - 2001-09-30 17:00:44
|
At Sun, 30 Sep 2001 16:48:18 -0400,
Kent Dahl <ke...@st...> wrote:
> ...I still get b==nil. Its not an immediate problem, as I can get the
> data thru the browser object, but since most Fltk callbacks use the
> idiom of a widget pointer and a void pointer as arguments in C++, this
> caught me by surprise.
If you'd like to get non-nil value, give the data like this:
@transactionlist.callback(somedata){ ... }
> Reading /ruby-fltk/doc/en/guide.txtand especially 3.2 seems to be
> somewhat misleading on this subject, as it states that only the data
> should be passed. I'm assuming it should say that the widget itself and
> the data will be passed. (Or is this changing?)
Here is a part of FLTK manual:
Each line contains a null-terminated string of text and a void * data pointer.
The text string is displayed, the void * pointer can be used by the callbacks
to reference the object the text describes.
If I don't misunderstand, I think this description mention
something like "a.data(a.value)" in your code,
and the void * pointer (= "a.data(a.value)") *can* be used
in the callback block.
@transactionlist.callback do |a,b|
puts a.value.to_s + ":" + a.data(a.value).to_s + ";" + b
end
But I don't be assure of my thought.
--
Takaaki Tateishi <tt...@kt...>
|