How to ge the handle of a menu?

The GetHMenuOf() macro seems not available …

Lui K. wrote:

The GetHMenuOf() macro seems not available …

Wx::Frame#get_menu_bar , I think

alex

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 F. wrote:

Lui K. wrote:

The GetHMenuOf() macro seems not available …

Wx::Frame#get_menu_bar , I think

alex

Forgive my terrible English …

This function seems to be a windows-only feature, it lives in
%WXWIN%/include/msw/menu.h

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.

On 08/03/2010 17:36, Lui K. 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

Done.

http://rubyforge.org/tracker/index.php?func=detail&aid=27945&group_id=35&atid=221

Alex F. wrote:

On 08/03/2010 17:36, Lui K. 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