Re: [Win32Lib] How add/remove MENU ITEMS "on the fly"?
- Posted by "danielmoyer" <danielmoyer at prodigy.net> Mar 09, 2005
- 493 views
> > posted by: Mario Steele <eumario at trilake.net> > > danielmoyer wrote: > > > > a related question: > > if, (to accomplish removing menu items as a program is running), I initially > > create the original menu items "in" a sequence and set handler(s) to them, & > > then allow app user to delete menu items from the sequence, & then destroy > > those controls, shouldn't I at some point also "destroy" the original > > handler connection made by "setHandler" for the controls destroyed? If so, > > how? (I presume then re-link handlers to the "new" controls.) > > > > Would it be something like this: > > setHandler ( SequenceOfAllOfTheControlsToBeDeleted, w32HClick, -1) ?? > > or, > > setHandler ( SequenceOfAllOfTheControlsToBeDeleted, w32HClick, {-1, > > routine_id("myhandler")} ) ?? > > > > And should I do this before I destroy the controls? > > > > Dan Moyer > > Actually, when you destroy() the control in question, it will remove all > handlers for that control automatically. So you wouldn't have to worry > about removing them. However, you will need to re-apply the handlers to > the control, when you re-make it. Otherwise, Win32lib will be sitting > there, twiddling it's thumbs, wondering what you want to do with the > control when an action happens on it. > > Mario Steele OH, very good to know that destroying a control also destroys the handler link(s), thanks! And it didn't hurt to mention the necessity to re-apply handlers to new controls, does follow logically, I kinda assumed that but I could'a been wrong. Dan