Someone contact me in person and proposed a solution to my problem. I post it
here just in case others might need a similar function.

In SciTEWin.cxx, lines 1549-1554

        case SCITE_TRAY:
                if (lParam == WM_LBUTTONDBLCLK) {
                        RestoreFromTray();
                        ::ShowWindow(MainHWND(), SW_RESTORE);
                        ::FlashWindow(MainHWND(), FALSE);
                }

After the last "}", insert the following:

                else if(lParam==WM_RBUTTONDOWN)
                {        
                        POINT pt;
                        HMENU popup = ::CreatePopupMenu();
                        GetCursorPos(&pt);
            
                        SString restore=props.Get("tray.menu.restore");
                        SString quit=props.Get("tray.menu.quit");
                        if(restore=="") restore="Restore";
                        if(quit=="") quit="Quit";
                        
                        ::AppendMenu(popup, MF_STRING, SW_RESTORE, 
restore.c_str());
                        ::AppendMenu(popup, MF_STRING, IDM_QUIT, quit.c_str());
                        UINT iSelection = ::TrackPopupMenu(popup, TPM_LEFTALIGN 
| TPM_RETURNCMD,
pt.x - 4, pt.y, 0, reinterpret_cast<HWND>(wSciTE.GetID()), NULL);
                        if (iSelection == IDM_QUIT)
                                {
                                        QuitProgram();
                                        ::FlashWindow(MainHWND(), FALSE);
                                }
                        else if (iSelection == SW_RESTORE)
                                {
                                        RestoreFromTray();
                                        ::ShowWindow(MainHWND(), SW_RESTORE);
                                        ::FlashWindow(MainHWND(), FALSE);
                                }
                        ::DestroyMenu(popup);


This code does not make use of the resources file so the tray menu cannot be
localized via the usual locale.properties file. For this reason two new
properties entry is added:

tray.menu.restore = 
tray.menu.quit =

these can be set in any of the properties files except in locale.properties
--- has to be changed later. 


instanton wrote:
> 
> On Windows SciTE can be set to minimize to system tray like many other
> Windows applications. However, unlike other Windows applications, right
> clicking on the SciTE tray icon does not pop a menu. It would be very
> convenient to add a tray right-click menu including at lease an
> "Open/Close File(s)" and/or an 'Exit SciTE" items. 
>   
>   
> instanton
> 
> _______________________________________________
> Scite-interest mailing list
> [email protected]
> http://mailman.lyra.org/mailman/listinfo/scite-interest
> 
> 

-- 
View this message in context: 
http://www.nabble.com/tray-right-click-menu--tf3922121.html#a11206513
Sent from the SciTE mailing list archive at Nabble.com.

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to