Re: TMainMenu



"Todd Frankson" <tfrankson@xxxxxxxxxxxxx> wrote in message news:47791eb3$1@xxxxxxxxxxxxxxxxxxxxxxxxx

Umm... Things disappeared sometimes.

Huh????
In develpoment or run time....


Design time.


I couldn't find a way to dynamicaly add actions to a TActionMainMenu
without
using indexing, like ...Items[0]. That's a real bunch of baloney. What? Am
I
coding in assembly? The only search for items that I found used Caption
and
if I'm not mistaken I can have duplicate captions.

Well, how would it work if items weren't numbered (indexed somehow)?
Magic??


If having a var or unique name of some kind to use instead of "only" index position is considered magic, then yes magic. I know it is hard to understand the advantages that Delphi developers have enjoyed for years. It's not really magic, although it sometimes seems like it.



When I moved something in the menus, code would always break.

Oh... so moving things from one event to another shouldn't break code? I
guess
having an event fire before something is ready, should work fine....


I don't know what you mean by "moving things from one event to another". What things? If I have to use the index then when the order of things change the code will break. Not unexpected, but a pretty "high-school" way of doing things. Good way to teach, but not a good way to develop maintainable code. When I'm using a TMainMenu I have item vars in the form to use. WOW! Come to think of it, how did those get there? Hmm... Must be magic! :-)

Seriously, if you know something I don't, I'd be glad to hear it. For example, if I want to add some menu items to a menu named "miView". Developing with TMainMenu I can just use miView.Add() and "viola" (a well known technique used by magicians) the new menu item is there for use. Developing with actions, the only way I could find is using the index starting at the TActionManager. There was a find item method, but it worked via the caption. I think I can have duplicate captions, so which item would be found?


.