Forum: wxRuby constants not recognized?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7b63707ddae18937c61d313d69fe2f29?d=identicon&s=25 Tim Ferrell (s0nspark)
on 2009-03-04 02:53
I just upgraded to wxRuby 2 and am having the following issue... With
code like this:

  dd = Wx::DirDialog.new(@dialog,
                         'Select the folder to process...',
                         File.join(@home, 'Desktop'),
                         Wx::DD_DEFAULT_STYLE | Wx::DD_DIR_MUST_EXIST |
Wx::DD_CHANGE_DIR)
  dd.show_modal == Wx::ID_OK ? @basedir = dd.get_path : exit

I get the following error:

  uninitialized constant Wxruby2::DD_DEFAULT_STYLE (NameError)

When I remove the style flags I get no such error...  Ideas?

I am on Mac OS X and I installed via the rubyforge gem...
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2009-03-04 20:02
(Received via mailing list)
Tim Ferrell wrote:
> I just upgraded to wxRuby 2 and am having the following issue... With
> code like this:
>

What version did you upgrade from?

>   dd = Wx::DirDialog.new(@dialog,
>                          'Select the folder to process...',
>                          File.join(@home, 'Desktop'),
>                          Wx::DD_DEFAULT_STYLE | Wx::DD_DIR_MUST_EXIST |
> Wx::DD_CHANGE_DIR)
>   dd.show_modal == Wx::ID_OK ? @basedir = dd.get_path : exit
>
> I get the following error:
>
>   uninitialized constant Wxruby2::DD_DEFAULT_STYLE (NameError)

Those constants look to be missing, thanks for the report. But I don't
believe any recent change has done this.

To work around this for now you can add the defines yourself:

Wx::DD_DEFAULT_STYLE = Wx::DEFAULT_DIALOG_STYLE|Wx::RESIZE_BORDER
Wx::DD_CHANGE_DIR = 0x0100
Wx::DD_DIR_MUST_EXIST = 0x0200

a
7b63707ddae18937c61d313d69fe2f29?d=identicon&s=25 Tim Ferrell (s0nspark)
on 2009-03-04 20:09
Alex Fenton wrote:
>
> What version did you upgrade from?
>

1.9.5 I think ... but this is new code anyway. I do know that the FD_*
constants were working and are not now as well... maybe that helps?

> Those constants look to be missing, thanks for the report. But I don't
> believe any recent change has done this.
>
> To work around this for now you can add the defines yourself:
>
> Wx::DD_DEFAULT_STYLE = Wx::DEFAULT_DIALOG_STYLE|Wx::RESIZE_BORDER
> Wx::DD_CHANGE_DIR = 0x0100
> Wx::DD_DIR_MUST_EXIST = 0x0200
>

Great - thanks for that!

Cheers,
Tim
7b63707ddae18937c61d313d69fe2f29?d=identicon&s=25 Tim Ferrell (s0nspark)
on 2009-03-04 20:13
Tim Ferrell wrote:

> 1.9.5 I think ... but this is new code anyway. I do know that the FD_*
> constants were working and are not now as well... maybe that helps?

Correction - only Wx::FD_DEFAULT_STYLE seems to be undefined...
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2009-03-04 20:47
(Received via mailing list)
Tim Ferrell wrote:
>> 1.9.5 I think ... but this is new code anyway. I do know that the FD_*
>> constants were working and are not now as well... maybe that helps?
>>

I don't think these have ever existed in wxRuby 1.9.x (though they
should have).

> Correction - only Wx::FD_DEFAULT_STYLE seems to be undefined...
>

Thanks again:

Wx::FD_DEFAULT_STYLE = Wx::FD_OPEN

alex
7b63707ddae18937c61d313d69fe2f29?d=identicon&s=25 Tim Ferrell (s0nspark)
on 2009-03-04 20:51
Alex Fenton wrote:
> I don't think these have ever existed in wxRuby 1.9.x (though they
> should have).

That is probably the case ... I went back and looked at a deployed app I
had and I had used Wx::FD_OPEN instead of Wx::FD_DEFAULT_STYLE then
anyway...

Thanks!
Tim
This topic is locked and can not be replied to.