Popup Menus

4 posts / 0 new
Last post
mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Popup Menus

Am I missing something or is it not possible to have a regular menu strip and use popup menus? WA_RMBTrap,TRUE, has to be used from I have gathered so far.

Is it not possible to open popup menu when in the body of the window, and open regular menu when mouse is over screen title bar?

Is the new Intuition Popup Menus still on the way to go along with the new Intuition regular menus?

mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Re: Popup Menus

Never mind. I want ContextMenus.

mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Re: Popup Menus

The supplied example for ContextMenus uses the old school method of GetMsg() instead of IDoMethod()....again.

How would this be updated:

  1. Wait(1 << win->UserPort->mp_SigBit);
  2.  
  3. while (imsg = (struct IntuiMessage *)GetMsg(win->UserPort))
  4. {
  5. class = imsg->Class;
  6. code = imsg->Code;
  7. iaddress = imsg->IAddress;
  8.  
  9. if (class == IDCMP_CLOSEWINDOW)
  10. {
  11. done = TRUE;
  12. }
  13. else if (class == IDCMP_MENUPICK)
  14. {
  15. struct TagItem *tags = ((struct ExtIntuiMessage *)imsg)->eim_TagList;

To the new style:

  1. if (Signals & SignalsMask)
  2. {
  3. while((Result=IIntuition->IDoMethod(Objects[OID_WINDOW],WM_HANDLEINPUT,&Code)) != WMHI_LASTMSG)
  4. {
  5. switch(Result & WMHI_CLASSMASK)
  6. {

How do I get a hold of an IntuiMessage to get the eim_TagList and IAddress? Do I have to call GetMsg() and ReplyMsg() at WHMI_MENUPICK? I am hoping there is a "modern" way of doing this.

And this section still using GadTools GTMENUITEM_USERDATA():

  1. uint32 item_id;
  2.  
  3. ci = (struct ColorItem *)GetTagData(IMTAG_MenuContext,0,MenuTags);
  4.  
  5. item = ItemAddress(iaddress,code);
  6.  
  7. while (item)
  8. {
  9. item_id = (uint32)GTMENUITEM_USERDATA(item);
  10. ....
  11. item = ItemAddress(iaddress,item->NextSelect);
  12. }

To the modern way of:

  1. while((Code=IIntuition->IDoMethod(MenuStripObj,MM_NEXTSELECT,0,Code)) != NO_MENU_ID)
  2. {
  3. switch(Code)
  4. {
  5. case MEN_ICONIFY:
  6. Iconify();
  7. break;
  8.  
  9. case MEN_QUIT:
mritter0
mritter0's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2014-04-21 21:15
Re: Popup Menus

Don't need GetMsg().

  1. if (Signals & SignalsMask)
  2. {
  3. while((Result=IIntuition->IDoMethod(Objects[OID_WINDOW],WM_HANDLEINPUT,&Code)) != WMHI_LASTMSG)
  4. {
  5. switch(Result & WMHI_CLASSMASK)
  6. {
  7. case WMHI_MENUPICK:
  8. IIntuition->GetAttrs(Objects[OID_WINDOW],
  9. WINDOW_MenuType, &MenuType,
  10. TAG_DONE);
  11. if (MenuType==IMT_DEFAULT)
  12. {
  13. Code=NO_MENU_ID;
  14. while((Code=IIntuition->IDoMethod(MenuStripObj,MM_NEXTSELECT,0,Code)) != NO_MENU_ID)
  15. {
  16. switch(Code)
  17. {
  18. case MEN_ICONIFY:
  19. Iconify();
  20. break;
  21.  
  22. case MEN_QUIT:
  23. if (Prefs->UseCommodity || Prefs->SetMethod)
  24. {
  25. CloseMainWindow();
  26. }
  27. else
  28. done=TRUE;
  29. break;
  30. }
  31. }
  32. }
  33. else if (MenuType==IMT_CONTEXT_GADGET_APP)
  34. {
  35. IIntuition->GetAttrs(Objects[OID_WINDOW],
  36. WINDOW_MenuAddress, &MenuAddress,
  37. TAG_DONE);
  38. if (MenuAddress==ContextMenuObj)
  39. {
  40. Code=NO_MENU_ID;
  41. while((Code=IIntuition->IDoMethod(ContextMenuObj,MM_NEXTSELECT,0,Code)) != NO_MENU_ID)
  42. {
  43. switch(Code)
  44. {
  45. case CONTEXT_OPEN:
  46. Code=RAWKEY_RETURN;
  47. Qualifier=0;
  48. HandleRawKeys();
  49. break;
  50. }
  51. }
  52. }
  53. }
  54. break;
Log in or register to post comments