The context menu thing, however, is especially difficult. The menus
themselves aren't "windowed" controls, meaning that they don't receive
messages themselves. Because of this, it's very difficult to tell whether
a menu has been right-clicked. You basically have to look for right-click
or context-menu messages at the parent window level, and then decide
whether a menu is visible, and then decide whether the click fell within
it. Very ugly. Unless I'm really missing something, it would probably be
easier to write a replacement menu control than to get context menus off
of standard menus.
Note that it _might_ be easier to acheive with "toolbar menus," which is
the "newer" style of menu that's made out of a toolbar. I know that you
can pop a context menu up off of the top of the menu when the menu isn't
visible (ie, you can right-click on "File" and pop up a context menu,
provided that you haven't left-clicked on "File" and caused its menu to
drop down).
-Jim
Ben Wing <ben(a)666.com> writes:
hmm, interesting.
and presumably the same method will let you capture events occurring over
the
item, by putting a control in there? i really want to be able to have
xemacs
menus have "help text" that appears in the status bar, and
handle
right-clicking
on a menu to bring up a context menu, so that users can more easily
personalize
the menu, which is abysmally difficult now.
if i do such a thing, how do i pass all the other events to the menu
handler?
or perhaps it snarfs them before even dispatching them to the
control?
i'm sure this stuff can be done because i've seen other apps do them, but
i
just
don't quite know how.
"James N. Potts" wrote:
>
> Under windows, it's more complicated than changing a resource, but it's
> really not very difficult. Especially if all menu items are drawn with
> the same face. You just set MF_OWNERDRAW when creating the menu items,
> and then handle the WM_MEASUREITEM and WM_DRAWITEM messages. (Much like
> any other "owner draw" item under windows. In fact, most of the code
can
> be salvaged from elsewhere.)
>
> Only took about 5 minutes to hack a menu in one of my programs to draw
in
> different faces (a different face for each line).
>
> -Jim Potts
>
> Ben Wing <ben(a)666.com> wrote:
>
> >in fact this is NOT hard or impossible under x, but is under windows.
> changing
> >x resources is easy from within the xemacs c code.
> >
> >
> >
> >"William M. Perry" wrote:
> >>
> >> Aaron Lehmann <aaronl(a)vitelus.com> writes:
> >>
> >> > > I know this would be hard or impossible under X, but what about
> windows?
> >> >
> >> > Why would it be impossible under X?
> >>
> >> Because all that stuff lives beyond the control of XEmacs (at least
it
> used
> >> to, I don't know about all the changes to lwlib that andy has done
> >> lately). Right now you can only specify it via X resources, not
from
> >> lisp.
> >>