Problem with mouseover and context menues

Discuss any general programming issues here
Post Reply
ilbarbax
Posts: 161
Joined: Thu Apr 01, 2010 6:41 pm

Problem with mouseover and context menues

Post by ilbarbax »

I have a strange behavior that I can't avoid as follow:
I have established an event on a number of buttons when mouse is over.
Then I added a context menu to do something activated when the mouse is over a button and obviously right mouse click.
Now if a do something trough the context menu options everything continue to work as expected.
If I do a cancel option on the selected context menu function everything continue to work as expected.
If I decide to do nothing and then I click elsewhere to disable the context menu the on mouseover option works ONLY for the latest button selected and I can't return to the default situation even freeing the context menu.

Got the problem with HW11 and HW10 too. Tested on Windows 10 and Aros, same behavior.

I'm arranging a test case asap or I can supply the whole script if required at sb5@libero.it

regards
plouf
Posts: 716
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Problem with mouseover and context menues

Post by plouf »

you have use custom functions to process menu item "mouseover" AND "right click over button" ?
context menu do it them selfs

does this problem occur and in this simplified example ?
(i cant reproduce or i have not understand ?)

Code: Select all

xml$ = [[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<menu title="Context menu" id="ctx1">
   <item id="1.1">Cut 1</item>
   <item id="1.2">Copy 1</item>
   <item id="1.3">Paste 1</item>
</menu>
<menu title="Context menu" id="ctx2">
   <item id="2.1">Cut 2</item>
   <item id="2.2">Copy 2</item>
   <item id="2.3">Paste 2</item>
</menu>
<menu title="Context menu" id="ctx3">
   <item id="3.1">Cut 3</item>
   <item id="3.2">Copy 3</item>
   <item id="3.3">Paste 3</item>
</menu>

	<window title="Test">
		<vgroup>
				<button id="b1" contextmenu="ctx1">1</button>
				<hline/><rectangle/>
				<button id="b2" contextmenu="ctx2">2</button>
				<hline/><rectangle/>
				<button id="b3" contextmenu="ctx3">3</button>
		</vgroup>
	</window>
</application>
]]

@REQUIRE "RapaGUI"


moai.CreateApp(xml$)
Function p_EventFunc(msg)
	ForEach(msg,DebugPrint)
EndFunction

InstallEventHandler({RapaGUI = p_EventFunc})

Repeat
	WaitEvent
Forever
Christos
ilbarbax
Posts: 161
Joined: Thu Apr 01, 2010 6:41 pm

Re: Problem with mouseover and context menues

Post by ilbarbax »

I'm not using rapagui but plain Hollywood code.
I have to verify... you may have given me an hint anyway
plouf
Posts: 716
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Problem with mouseover and context menues

Post by plouf »

yes i see this in this example, however EnableButton() makes this active !?

check this simplified example and comment/uncomment EnableButton()

Code: Select all

CreateMenu(1, {{"Unused", {
   {"Cut1", ID = "cut1"},
   {"Copy1", ID = "copy1"},
   {"Paste1", ID = "paste1"},
}}})
CreateMenu(2, {{"Unused", {
   {"Cut2", ID = "cut2"},
   {"Copy2", ID = "copy2"},
   {"Paste2", ID = "paste2"},
}}})

CreateMenu(3, {{"Unused", {
   {"Cut3", ID = "cut3"},
   {"Copy3", ID = "copy3"},
   {"Paste3", ID = "paste3"},
}}})


Function p_EventFunc(msg)
	ForEach(msg,DebugPrint)
	DebugPrint("--------------")
	If msg.action="OnRightMouseDown"
			PopupMenu(msg.id)
			;EnableButton(msg.id)
	EndIf
EndFunction

evtmatch= {onMouseover = p_EventFunc,OnRightMouseDown= p_EventFunc}
MakeButton(1, #SIMPLEBUTTON, 10, 10, 50, 50,evtmatch)
MakeButton(2, #SIMPLEBUTTON, 100, 10,50, 50,evtmatch)
MakeButton(3, #SIMPLEBUTTON, 200, 10,50, 50,evtmatch)

Box(10, 10, 50, 50,#RED)
Box(100, 10,50, 50,#RED)
Box(200, 10,50, 50,#RED)

Repeat
	WaitEvent
Forever
Christos
Post Reply