mague Posted December 25, 2009 Share Posted December 25, 2009 Hello, how do i add a button to a popup menu ? I tried: fosd.QueryInterface(IID_IDVBOSD,dvbosd); dvbosd.AddMenuButton(2900, 0,'MyEntry', '', '', '',''); Where 2900 should be the ID of the Videos popup menu. It compiles but doesnt do anything. The problem is probabyl that ID 2900 does not exist when i call AddMenuButton(). When is this menu initialised ? I thought it should be availabe once MediaCenter->Videos was opened ? Thankful for any hint. Quote Link to comment
mague Posted December 25, 2009 Author Share Posted December 25, 2009 Seems i found the problem myself According to DVB Spy all context menus do have ID 2900. This leads me to the conclusion that all context menus are created dynamic. Am i right that it happens like this.. case action.ID of ACTION_BLUE: begin //create some context menu id_2900 on the fly result := S_OK; end; ACTION_YELLOW: begin result := S_OK; end; ACTION_GREEN: begin result := S_OK; end; ACTION_RED: begin result := S_OK; end; end; This would be very bad news since not only all OSD_color buttons but the context menus too are locked away from plugins. Means we have to invent the wheel everytime again and can not add to the existing functionality. It might be to much to ask for a rewrite of the OSD_color buttonn handling, but maybe the context menu handling ? I didnt count them, but there are probably only 20 different context menus. Quote Link to comment
SnoopyDog Posted January 11, 2010 Share Posted January 11, 2010 (edited) In basic, it's possible. Just tried it some minutes ago. But Lars told me, "AddMenuButton" is not the correct function. With this you can add a new entry to a popup menu: IF OSDWindowManager <> NIL THEN BEGIN OSDWindowManager.GetWindow(WindowID,Something); IF Something <> NIL THEN BEGIN Menu := Something AS iDLGPopupMenu; Menu.AddLabel('Test',21,FALSE); END; { THEN } END; { THEN } You have to do this inside the "DVBViewerEventOSDWindow" Method which is part of the "DVBViewerEvents" interface. To add context sensitive items, you have to track the CurrentWindow ID - e.g if current window is OSD_WIN_MUSIC = 5 then don't add an entry, if current window is 6 ( OSD_WIN_MOVIES ) then add an entry, and so on. My current problem is now: i see the new label "Test" in the popup menu, but it does nothing! Don't know how to deal with the second parameter "ID" of "AddLabel". Forgot: You have to use both, the "normal" DVBViewer Interface and the OSDPlugin Interface. Edited January 11, 2010 by SnoopyDog Quote Link to comment
SnoopyDog Posted July 8, 2010 Share Posted July 8, 2010 Finally i found out how to handle this, but it's a bit circuitous. Maybe Lars will throw up his hands in horror when he will see this I'll post the solution when i have a bit time. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.