[MacRuby-devel] Checkbox state
John Shea
johnmacshea at gmail.com
Wed Jul 8 06:28:05 PDT 2009
Hi Marinus / Rien,
I just did a quick test, given a nib with window and a controller ruby
file.
1. I dragged a checkbox NSButton onto the window
2. i created an attr_accessor :check in my controller
3. I created a method called test_check in my controller:
def test_check(sender)
p @check.state
end
4. I linked @check and the test_check method to the checkbox
And when i click on an off the checkbox the state toggles between 0
and 1.
So I do not think it is an issue MacRuby - could you try something
simple like the above?
How were you polling the check box state? That is: which method is
status = @myCheckbox.state in?
Perhaps this method is not being called.
Cheers,
John
On Jul 8, 2009, at 15:06 , Marinus van der Lugt wrote:
> Hi All,
>
> First post, so a little bit about me: I am a SW engineer and have
> been one
> for over 20 years, increadible as that may sound. I have programmed
> on the
> Mac before in Ada95, Obj-C and Java (but I have had a pause of about 5
> years from the Mac). Now that MacRuby seems to gain some foothold
> I'd like
> to get back to the mac and make the jump from Obj-C to MacRuby.
>
> I work in Xcode, and have just started a new MacRuby Core-Data
> Application.
>
> The first goings look good, but in implementing my first window
> controller
> I ran into a (little?) problem: I cannot get the state of a checkbox:
>
> status = @myCheckbox.state
>
> always returns a Fixnum with value 0. regardless of the visual
> representation of the checkbox (i.e. selected or not)
>
> The checkbox should be mapped correctly because:
>
> myTitle = @myCheckbox.title
>
> does indeed give me the title I set in the IB.
> I checked the archives but did not find any discussions about this.
> There was something about checkboxes and hotcocoa, but I do not use
> hotcocoa.
>
> The best solution would be a simple stupid mistake on my part :-)
>
> Any takers?
>
> Regards,
> Rien.
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
More information about the MacRuby-devel
mailing list