Neil Hodgson <nyamatongwe <at> gmail.com> writes:
>
> mozers:
>
> > - cascading menu Tools, recording and playing macro
>
> The _MAX_EXTENSION_RECURSIVE_CALL stuff looks like a bandage on a
> systemic problem and I really don't trust it.
> ...
> ...
> Neil
>
Dear Neil Hodgson.
I've already twice tried to reply on your message mentioned above. (It must be
somthing wrong with gmane service.)
You didn't like recursive call in cascading menu Tools made by Ru-Board team.
Frankly speaking I didn't like it too, but I use it when I need to introduce
some idea clearly and fast. It's simple to rewrite any recursive function into
recursiveless one, but code would be slightly bigger and complicated. For
example function ReleaseMenu can looks like that (this is example only, but I
compiled build with it and it works.):
void Menu::ReleaseMenu(HMENU hMenu) {
int ptr = 0, to_check = 0;
struct UserMenu {
HMENU hMenu;
} UMenu[100]; // The number 100 can be get form some constant. (it is
example
only)
UMenu[ptr++].hMenu = hMenu;
//~ Fill the struct with pointers that must be released
do {
for (int i = 0; i < ::GetMenuItemCount(UMenu[to_check].hMenu); i++)
UMenu[ptr++].hMenu = ::GetSubMenu(UMenu[to_check].hMenu, i);
to_check++; //~ We've just finished checked this menu, let's move to the
next one. If there isn't any more to_check will approach to ptr.
} while (to_check<=ptr);
//~ In descending order destroy all the menus
for (int i = ptr-1; i >= 0; i--)
::DestroyMenu(UMenu[i].hMenu);
}
If you like you can write me or change the code by yourself. But I would be
very
appreciate if you pay attention to the idea of cascade menu. Amount you lua
scripts grows day by day and your SciTE Tools menu needs to be organised.
Sincerelly yours. Alexander Zenkov.
[EMAIL PROTECTED]
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest