class DynMenu inherit Menu
protect _aMenuItems as array // The item of the menu
protect _aAcceleratorKeys as array // The accelerator keys
protect _aMenuChoices as array // array of descriptions and associated methods
protect _aMethodIDs as array // The methods and ID's
protect _oKeys as DynMenuAcceleratorKeys // added
method ActivateAcceleratorKeys( oOwner )
// Create an accelerator class instance from the keys registred with this menu
_oKeys := DynMenuAcceleratorKeys{ self:AcceleratorKeys } // using the protect and not more the local variable
// Set the AcceleratorKeys for this menu
self:Accelerator := DynMenuAccelerator{ GetNextMenuID(), _oKeys:GetAcceleratorHandle }
if IsInstanceOfUsual( oOwner, #Window )
SetAccelerator( oOwner:Handle(), self:Accelerator:Handle() )
endif
return self:Accelerator
Thank you very, very much!
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Good catch, glad you have it working now! Btw, an alternative way to fix it would be to change the LOCAL into a STATIC LOCAL, which also retains its value. Both ways are totally fine of course.
Hi Chris,
yes, I'm really happy that it works now.
But without the help from Karl-Heinz (the combination with resizing) and from you (the hint with the GC) I would never have solved it.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it