[Cuis-dev] MenuItemMorph mouseButton1Up:localPosition: not called (was: Theme customization ... browser buttons)

Bernhard Pieber bernhard at pieber.com
Sat Mar 18 14:55:06 PDT 2023


Looking deeper I realized I was wrong. The method #mouseButton1Up:localPosition: is indeed called. However, if I hold the Shift key owner hasFocus returns false while it returns true if I don’t. Therefore, when the Shift key is pressed the action is not invoked.

I found it out be printing to the Transcript like this:

mouseButton1Up: aMouseButtonEvent localPosition: localEventPosition
	"Handle a mouse up event. Menu items get activated when the mouse is over them. Do nothing if we're not in a 'valid menu transition', meaning that the current hand focus must be aimed at the owning menu."
Transcript cr; show: 'mouseButton1Up'.
	owner hasMouseFocus ifFalse: [ ^self ].
Transcript space; show: 'after owner hasMouseFocus'.
	"This will happen if the menu has toggles in it. (for instance, the 'show...' button)
	Update the look, refresh the world and wait a bit,
	to give the user some visual feedback"
	contentString ifNotNil: [
		self contentsWithMarkers: contentString inverse: true.
		self world ifNotNil: [ :w | w displayWorld ].  "show myself"
		(Delay forMilliseconds: 200) wait].
	self deselect.
	self invokeWithEvent: aMouseButtonEvent

I wonder if this is a bug or a feature?

Cheers,
Bernhard


> Am 18.03.2023 um 18:51 schrieb Bernhard Pieber <bernhard at pieber.com>:
>
> Hi everyone,
>
> I tried to implement the feature for MenuItemMorphs but failed. For some reasons #mouseButton1Up:localPosition: is not called when a modifier key (Shift, Control, Alt) is pressed. I tried to find it out myself but failed. Can anyone explain this behaviour?
>
> I found a feature which I did not know. When clicking a menu item morph with Alt and Shift pressed the menu item is duplicated and attached to the hand. Where is this implemented?
>
> Bernhard
>
>> Am 18.03.2023 um 17:11 schrieb Bernhard Pieber via Cuis-dev <cuis-dev at lists.cuis.st>:
>>
>> And because it sounded like fun I created a first. File it in and you can debug any PluggableButtonMorph action when you click it with the Shift key pressed.
>>
>> Things to do:
>> - Do the same for the secondary action button.
>> - Do the same for menu item selection.
>> - Add a new prefProgramming preference.
>>
>> <5706-CuisCore-BernhardPieber-2023Mar18-16h18m-bp.001.cs.st>
>




More information about the Cuis-dev mailing list