StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
kassiop  
#1 Posted : Sunday, May 23, 2021 2:31:29 AM(UTC)
kassiop

Rank: Member

Reputation:

Groups: Approved
Joined: 5/16/2021(UTC)
Posts: 10

I decided to show a menu with X1 button.
But script for gesture don’t work after inserted to X1 Click Enabled:
1) PopupMenuInfo – tried to show menu at left upper point of screen, but close it with id=0.
2) PopupMenuInfoEx – shows the menu but doesn’t perform any actin argument for item ().
Code:
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("c# search", `sp.SendString("c# | .NET "); `));

also I tried to remove gesture from action and checked Modifier button X1, it doesn’t work too.
Rob  
#2 Posted : Thursday, June 3, 2021 4:41:18 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 952
United States
Location: Tampa, FL

Thanks: 22 times
Was thanked: 274 time(s) in 239 post(s)
So you see the menu but if you click on an item with the left button, nothing happens?
Does the menu item go away when you click?

Are you consuming the X1 click event?
kassiop  
#3 Posted : Thursday, June 3, 2021 9:24:08 PM(UTC)
kassiop

Rank: Member

Reputation:

Groups: Approved
Joined: 5/16/2021(UTC)
Posts: 10

1) PopupMenuInfo – menu shown at the correct point. ( I fixed location)
but it is auto closed in a moment and shows message box with id = 0 (twice)
Consume click event doesn't affect.
Code:
var popupMenuInfo = new  PopupMenuInfo();
		popupMenuInfo.Items.Add("ItemA");
		popupMenuInfo.Items.Add("ItemB");
		popupMenuInfo.Items.Add("Cancel");
		 popupMenuInfo.Location = sp.GetCurrentMousePoint();
		popupMenuInfo.Callback = "PopupMenuMainCallback";
		var res = sp.ShowPopupMenu(popupMenuInfo);

Load
Code:
function PopupMenuMainCallback(id) {
	if (id == 1) {
                 sp.SendString("Value-1");
                 sp.SendKeys('~');
        } else if (id == 2)  {
                 sp.SendString("Value-2");
                 sp.SendKeys('~');
        }  else {
                sp.MessageBox(""+id, "Selected Menu Item");
        }
}


2. PopupMenuInfoEx after clicking on menu item menu closed
but text is not inserted in textbox (notepad)
Consume click event doesn't affect.
Code:
var popupMenuInfoEx = new PopupMenuInfoEx(sp.GetCurrentMousePoint());
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("ItemA", `sp.SendString("Value-1"); sp.SendKeys('~');`));
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("ItemB", `sp.SendString("Value-2"); sp.SendKeys('~');`));
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("c# search", `sp.SendString("c# | .NET "); `));
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("Close Popup", ""));
sp.ShowPopupMenuEx(popupMenuInfoEx);


These scripts work ok attached to gestures.
Rob  
#4 Posted : Thursday, June 3, 2021 10:29:14 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 952
United States
Location: Tampa, FL

Thanks: 22 times
Was thanked: 274 time(s) in 239 post(s)
Click has two events, down and up, so if you don't qualify the event, it will get called twice which may explain the issue.

On phone, so not nice format, but wrap in

if(click.Down) {
...script
}

Or !click.Down to trigger on X1 release.
Rob  
#5 Posted : Thursday, June 3, 2021 10:40:24 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 952
United States
Location: Tampa, FL

Thanks: 22 times
Was thanked: 274 time(s) in 239 post(s)
The popupinfo object only holds one instance in the action engine, so the second call is replacing the first quickly, and the menu item objects are dereferenced, which would explain why nothing happens.
kassiop  
#6 Posted : Thursday, June 3, 2021 10:59:58 PM(UTC)
kassiop

Rank: Member

Reputation:

Groups: Approved
Joined: 5/16/2021(UTC)
Posts: 10

Yes, if(click.Down) { ...script } fixed both cases.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.