Jump to content

Question about Menu


mague

Recommended Posts

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.

Link to comment

Seems i found the problem myself :biggrin:

 

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 :bye: 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.

Link to comment
  • 3 weeks later...

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 by SnoopyDog
Link to comment
  • 5 months later...

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...