How to customize browse list popup menu

Hello !
Is there a way to customize popup that appears when user right-clicks on browse list ?

Hello,
You need to give us some more information about what you want.
You can add icons, sub-menus, etc.
Here’s one example:

2 Likes

To answer your question: Yes. :wink:

To elaborate a little more.
A BrowseClass has SELF.UsePopup and SELF.Popup (a &PopupClass)
See BrowseClass.SetAlerts for calls to configure the PopupClass

For any popup:

  • you can easily add icons and short cut keys
  • With a little more property syntax work, you can add things like BOLD to a given item
  • You can also use SYSTEM{PROP:MenuStyle} to alter the font and more, consider using the MenuStyleManager to help with that (Libsrc\Win\MenuStyle.[inc|clw])

Can you give me an example ?

Not without some more direction as to what you’re looking for.

Basically, when Windows ABC application is created, whenever you create new browse, you can select a theme, and then you can get to customize things, such as what options and icons will be shown on right-click popup.
image

Now, I would like to change those icons Next to “Insert”, “Change”, “Delete” and “View”…
BUT ONLY in the popup ! Those icons in the buttons below (horizontally stacked) should remain the same…

OK, what you’re seeing is the result of the code in BrowseClass.SetAlerts
where you see calls to SELF.Popup.AddItemMimic(…)

A quick glance a PopupClass shows me that there’s not a way to clear the PopupClass.PopupItems.MimicMode value once it’s been added. You can not
even derive a popupClass and do it because of the (poor) way that the class is written.

So, you’ll want to avoid having your BrowseClass.SetAlerts make those .AddItemMimic calls.
Looking at BrowseClass.SetAlerts, it looks like you can set BrowseClass.EditViaPopup to false in a derived method of BroweClass (as the property is ,PROTECTED for some reason)

Then you’ll want to make your own calls into PopupClass
which will include a call to .PopupClass.SetIcon(Name, Icon)

Here’s an example from my production code.
As you can see, I’m not avoiding the calls to .AddItemMimic here.

note: I use the following equate for clarity.
FEQ EQUATE(SIGNED)

BRW1.SetAlerts                              PROCEDURE()
ControlID FEQ
PopupName CSTRING(FILE:MaxFileName),AUTO 
  CODE
  PARENT.SetAlerts()
  IF SELF.EditViaPopup       
     SELF.Popup.AddItem('-','SeparatorWythe',SELF.Popup.GetItems(),1)


     ControlID = 0
     !SELF.Popup.AddItem('-','SeparatorMaterial',SELF.Popup.GetItems(),1)
     PopupName = SELF.Popup.AddItemEvent('Favorite C', EVENT:User_Favorite_C, ControlID); SELF.Popup.SetIcon(PopupName,'C.ICO')
     PopupName = SELF.Popup.AddItemEvent('Favorite D', EVENT:User_Favorite_D, ControlID); SELF.Popup.SetIcon(PopupName,'D.ICO')
     PopupName = SELF.Popup.AddItemEvent('Favorite E', EVENT:User_Favorite_E, ControlID); SELF.Popup.SetIcon(PopupName,'E.ICO')
     PopupName = SELF.Popup.AddItem('-','SeparatorMaterial',SELF.Popup.GetItems(),1)
     PopupName = SELF.Popup.AddItemEvent('Favorite F', EVENT:User_Favorite_F, ControlID); SELF.Popup.SetIcon(PopupName,'F.ICO')
     PopupName = SELF.Popup.AddItemEvent('Favorite G', EVENT:User_Favorite_G, ControlID); SELF.Popup.SetIcon(PopupName,'G.ICO')
     PopupName = SELF.Popup.AddItemEvent('Favorite H', EVENT:User_Favorite_H, ControlID); SELF.Popup.SetIcon(PopupName,'H.ICO')
  END

The insert/change/delete/view are item “mimics”, added by .AddItemMimic method for the popup class.
You can override the icon using SetIcon.

Embed in your browse class .SetAlerts method, after the parent call.

  SELF.Popup.SetIcon('Insert','~MyNewIcon.ico')

1 Like

Additionally, if you want no icons at all on your popup, you can use YourPopup.SetNoIcons(TRUE).

Mark,

How do you add Submenus?

Like in the in Riick’s Example “Bid-Item Status”?

Thank you in advance

EXACTLY what I needed ! Thanks !

The help actually has quite a bit of documentation about the PopupClass, including the AddMenu method.

It would be neat to have a Carl-styled example that uses all of the PopupClass’s methods and properties, though.

I’ll add that I never construct a POPUP string by hand anymore. The PopupClass is quite useful, even in hand coded projects. It’s not perfect, but IMO it’s one of the best things in ABC.

Just what I was looking for.
But if I add PopUp Items with AddItemMimic using e.g SELF.Popup.AddItemMimic(‘Excel’,?ExcelButton) and want to change the icon used on the ?ExcelButton. How do I achieve that?

?ExcelButton{PROP:Icon}='~MyExcelIcon.ico'

The Tilde indicates the .Ico file is linked into the current project, which is what you want.

The “problem” is that the icon on the ?Excel button is too large for the popup menu, so I want to use a smaller icon.

image

If you’re asking how to change the Icon on the Popup Item after you call SELF.Popup.AddItemMimic(‘Excel’,?ExcelButton) I think that would be:

SELF.Popup.SetIcon('Excel','~ExcelIconSmall.ico')

I’ve tried that, but as far as I can see it’s not working.

You have to create a icon with size 16 only for drop down menus. Clarion do not have the option to choose the icon to use in the icon file, namely 16, 32, 48, etc.

That is exactly what I have done. But I don’t know how to use that icon in the popup menu when I use AddItemMimic. AddItemMimic use the icon from the button witch is too large for the popup.
I can use SELF.Popup.SetIcon(‘Insert’,‘Insert16.ico’) for the popup generated by the template (Allow Edit via Popup), but not for the popup made by AddItemMimic.

    SELF.Popup.AddItemMimic('UploadDocuments',?Upload_BUTTON,'Upload Document/s')
    SELF.Popup.SetIcon('UploadDocuments','~ICONS\Upload-16.ico')