Strange issue with transported applications

This forum is meant for questions and discussions about the X# language and tools
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Strange issue with transported applications

Post by wriedmann »

Hi Chris,
thank you very much, I have my solution now:

Code: Select all

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
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Strange issue with transported applications

Post by Chris »

Hi Wolfgang,

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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Strange issue with transported applications

Post by wriedmann »

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
Post Reply