Forum: wxRuby How to ge the handle of a menu?

00e4a880b1262a125b5e342e4b536765?d=identicon&s=25 Lui Kore (night_stalker)
on 2010-03-06 17:02
The GetHMenuOf() macro seems not available ...
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2010-03-08 14:56
(Received via mailing list)
Lui Kore wrote:
> The GetHMenuOf() macro seems not available ...
>

Wx::Frame#get_menu_bar , I think

alex
00e4a880b1262a125b5e342e4b536765?d=identicon&s=25 Lui Kore (night_stalker)
on 2010-03-08 16:00
Sorry, I mean the handle of a popup menu.
On Windows it's an HMENU value, which is an Fixnum in ruby.

I need this handle to do some platform specific operations (for example,
add shell context menu) but still don't know how to get it.

In wxwidgets(C++), the prototype in wxMenu is:


class WXDLLEXPORT wxMenu : public wxMenuBase
{
public:
    ...
    WXHMENU GetHMenu() const { return m_hMenu; }


But there's no such get_hmenu in wxRuby.

Alex Fenton wrote:
> Lui Kore wrote:
>> The GetHMenuOf() macro seems not available ...
>>
>
> Wx::Frame#get_menu_bar , I think
>
> alex
00e4a880b1262a125b5e342e4b536765?d=identicon&s=25 Lui Kore (night_stalker)
on 2010-03-08 16:11
Forgive my terrible English ...

This function seems to be a windows-only feature, it lives in
%WXWIN%/include/msw/menu.h
00e4a880b1262a125b5e342e4b536765?d=identicon&s=25 Lui Kore (night_stalker)
on 2010-03-08 18:36
Solved. I added these lines to swig/classes/include/wxMenu.h, at about
line 43:

#ifdef __WXMSW__
    long GetHMenu() { return (long)m_hMenu; }
#endif

Re-swig and re-compile, then Menu#get_h_menu works.
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2010-03-09 01:27
(Received via mailing list)
On 08/03/2010 17:36, Lui Kore wrote:
> Solved. I added these lines to swig/classes/include/wxMenu.h, at about
> line 43:
>
> #ifdef __WXMSW__
>      long GetHMenu() { return (long)m_hMenu; }
> #endif
>
> Re-swig and re-compile, then Menu#get_h_menu works.
>

Thanks - the macros in Wx aren't documented very systematically so some
important ones might be missing from wxRuby.

Could you submit this as a bug or feature request on the Rubyforge site
please, and we should be able to put it in the next main release.

thanks
alex
00e4a880b1262a125b5e342e4b536765?d=identicon&s=25 Lui Kore (night_stalker)
on 2010-03-09 04:54
Done.

http://rubyforge.org/tracker/index.php?func=detail...

Alex Fenton wrote:
> On 08/03/2010 17:36, Lui Kore wrote:
>> Solved. I added these lines to swig/classes/include/wxMenu.h, at about
>> line 43:
>>
>> #ifdef __WXMSW__
>>      long GetHMenu() { return (long)m_hMenu; }
>> #endif
>>
>> Re-swig and re-compile, then Menu#get_h_menu works.
>>
>
> Thanks - the macros in Wx aren't documented very systematically so some
> important ones might be missing from wxRuby.
>
> Could you submit this as a bug or feature request on the Rubyforge site
> please, and we should be able to put it in the next main release.
>
> thanks
> alex
This topic is locked and can not be replied to.