This is the Personal Stock Monitor scripting developers forum.
Not logged in.
2010-11-26 21:48:31
1 of 8
#2569
Howdy All,

Is it possible to add an extension entry to the right-click context-sensitive menu of the portfolio display screen, instead of the Tools main menu?

If so, how?

Thank you,

-Don
Posted by: dgoyette
2010-11-27 15:59:36
2 of 8
#2579
in reply to #2569
You can get the OnMenuPopup event, but there is currently no easy way to tell which menu is popped up, so you have to check one of the other menu items to see if it's the right menu.
Posted by: Anatoly
2010-11-27 19:51:00
3 of 8
#2586
in reply to #2579
Could you provide a few lines of example code?

Thank you much,

-Don
Posted by: dgoyette
2010-11-30 21:18:13
4 of 8
#2610
in reply to #2586
I've actually added a way to get the application context of a popup menu for the next release so you don't have to check menu items. Still have to test it though.

Finding the menu based on the menu items is a bit problematic, especially if the same menu item also appears in a top-level menu. You may have to check for two items in the OnMenuPopup event, such as

<code>
If menu.Find("Account Tab Properties...") <> -1 and menu.Find("Clear Alerts") <> -1 Then
   ' this is the account tab menu, do something
End If
</code>
Posted by: Anatoly
2010-12-01 18:40:18
5 of 8
#2621
in reply to #2610
Thank you Anatoly. I'll play around with this example.

Looking forward to having it built-in

-Don
Posted by: dgoyette
2010-12-02 21:48:07
6 of 8
#2636
in reply to #2621

*** W A R N I N G ***

To anyone wanting to play around with the OnMenuPopup event ...

I just learned this the hard way ... if you put a MsgBox inside this event, it will CANCEL PSMs ability to display ALL of it's menus! Which makes it impossible to access any of the PSM menu functions, not to mention making it impossible to Uninstall your extension.

Use EXTREME CAUTION in playing around with this event.

Posted by: dgoyette
2010-12-03 00:39:18
7 of 8
#2643
in reply to #2636
Fortunately there is a fairly easy way to remove the offending extension if this does happen.

- Install sqlite database browser from http://sqlitebrowser.sourceforge.net/

- Find and open the PSMScript.db file on your machine, which will be somewhere in the Application Data folder, which is usually a sibling to the My Documents folder.

- Browse the extensions table, and delete your extension. PSM should run fine now.
Posted by: Anatoly
2010-12-03 02:29:10
8 of 8
#2651
in reply to #2643
It worked perfectly!

Thank you Anatoly!
Posted by: dgoyette