Lyle Johnson <lyle / users.sourceforge.net> wrote:
> Oh, no, that's not how the Ruby version of FXDataTarget works. For
> FXRuby, you need to work directly with the data target's value, i.e.
> setting it:
>
> dt.value = "spam"
>
> or reading it back:
>
> puts "current value is #{dt.value}"
>
> You are correct that this is different from the C++ implementation,
> because in C++ the data target actually stores a C++ reference to the
> variable of interest. We can't do that in Ruby, since some of the
> primitive object types (namely, integers and floats) are immutable objects.
Ok, that makes sense. I'm glad I'm not losing it. ;-) This could be
better documented.
> If this is too restrictive for your application, you might want to check
> out some work that Joel VanderWerf has done with his FoxTails extension
> for FXRuby (http://raa.ruby-lang.org/list.rhtml?name=foxtails). It takes
> advantage of the "observable" module (another of Joel's creations) to
> allow you to connect GUI components to observable attributes. This is a
> potentially much more powerful approach and it may offer the kind of
> solution you're looking for.
Looks very interesting. Indeed this is exactly the sort of thing we are
doing.
--
Hans Fugal | De gustibus non disputandum est.
http://hans.fugal.net/ | Debian, vim, mutt, ruby, text, gpg
http://gdmxml.fugal.net/ | WindowMaker, gaim, UTF-8, RISC, JS Bach
---------------------------------------------------------------------
GnuPG Fingerprint: 6940 87C5 6610 567F 1E95 CB5E FC98 E8CD E0AA D460