Popup menu in a slider

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
mwilliams
Posts: 15
Joined: Sat May 28, 2016 1:45 am

Popup menu in a slider

Post by mwilliams » Mon Nov 18, 2019 4:16 pm

I have a rp that I put on one of the slider pop outs that has a list on it. I want to add a context menu (right-click) on the list but it doesn't seem to fire. I added the popup menu via the popup keyword but it doesn't seem to work. Just to test, I did do a an item click event on the list and manually show the menu just to verify that it worked. I was wondering if there maybe some trick to this. We have several pop up menus on custom grid list browsers and they work fine. I just don't know if maybe it has something to do with putting it in a slider.

mwilliams
Posts: 15
Joined: Sat May 28, 2016 1:45 am

Re: Popup menu in a slider

Post by mwilliams » Tue Dec 03, 2019 12:22 pm

It looks like the popup menu works if I have the slider docked but not when it's floating. Is there a way to temporarily dock the slider programmatically and/or force the slide to stay open and not disappear?

dannyoorburg
Posts: 169
Joined: Mon Jan 04, 2016 9:50 am
Location: Australia

Re: Popup menu in a slider

Post by dannyoorburg » Tue Dec 03, 2019 1:27 pm

Hi,

This is just a guess because there's not that much to go on, I'm assuming you're using VLF ONE?

If so, the problem might be the lack of context for the popup, have a look at the following sample page.

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)

Define_Com Class(#PRIM_PHBN) Name(#Button1) Parent(#COM_OWNER) DisplayPosition(1) TabPosition(1) Width(215) Caption('Show Popup')

Define_Com Class(#PRIM_PPNL) Name(#Popup1) Width(300) Height(200)
Define_Com Class(#PRIM_PHBN) Name(#Button2) Parent(#Popup1) DisplayPosition(1) TabPosition(1) Width(200) Caption('This popup will disappear')
Define_Com Class(#PRIM_PHBN) Name(#Button3) Parent(#Popup1) DisplayPosition(2) TabPosition(2) Top(50) Width(200) Caption('This popup will NOT disappear')

Define_Com Class(#PRIM_PPNL) Name(#Popup2) Width(100) Height(100)
Define_Com Class(#PRIM_LABL) Name(#Label2) Parent(#Popup2) Caption('Popup2') DisplayPosition(1) TabPosition(1) TabStop(False)

Evtroutine Handling(#Button1.Click)

#Popup1.ShowPopup Placement(Center)

Endroutine

Evtroutine Handling(#Button2.Click)

#Popup2.ShowPopup Placement(Center)

Endroutine

Evtroutine Handling(#Button3.Click)

#Popup2.ShowPopup Placement(Center) Context(#Button3)

Endroutine

End_Com
Cheers,
Danny

mwilliams
Posts: 15
Joined: Sat May 28, 2016 1:45 am

Re: Popup menu in a slider

Post by mwilliams » Thu Dec 05, 2019 11:10 am

Hey sorry. Yes I'm using vlf-one. I have tried using the context and that didn't seem to help.

Slider Code:

Code: Select all

* -----------------------------------------------------------------------------------------------
* This is the right pane slider for framework  SD-One Framework
* Created 7th November 2019 by T22MWILL with Material Design style controls.
* -----------------------------------------------------------------------------------------------
* Press the Ctrl key, then mouse over the URL and click to open the information in a browser.
* The arrow indicates the type of panel this reusable part is.
*
* => Slide in panels - https://%lansadocs%/lansa048/content/lansa/lansa048_6895.htm
*    Assistance panel - https://%lansadocs%/lansa048/content/lansa/lansa048_6900.htm
*    Settings panel -  https://%lansadocs%/lansa048/content/lansa/lansa048_6905.htm
*    Background panel - https://%lansadocs%/lansa048/content/lansa/lansa048_6915.htm
*
* -----------------------------------------------------------------------------------------------
Begin_Com Role(*EXTENDS #VF_AC028O) Height(500) Width(417)

* -----------------------------------------------------------------------------------------------
Define_Com Class(*ANCESTOR) Name(#CloseImage) Left(385)
Define_Com Class(*ANCESTOR) Name(#CustomPanelBody) Height(482) Width(417) Layoutmanager(#AttachLayoutManager) Displayposition(2)
Define_Com Class(*ANCESTOR) Name(#DockImage) Left(401)
Define_Com Class(*ANCESTOR) Name(#HeaderPanel) Width(417) Displayposition(1)
* -----------------------------------------------------------------------------------------------

* Layout Manager
Define_Com Class(#PRIM_ATLM) Name(#AttachLayoutManager)
Define_Com Class(#PRIM_ATLI) Name(#AttachItem_Panel) Parent(#AttachLayoutManager) Manage(#Favorites) Attachment(Center) Margintop(20)

Define_Com Class(#SD1_FavoritesPanel) Name(#Favorites) Parent(#CustomPanelBody) Height(462) Top(20)

Define_Com Class(#PRIM_VS.Style) Name(#Noborders) Borderbottom(0) Borderleft(0) Bordertop(0) Borderright(0)



* -----------------------------------------------------------------------------------------------
* add these 3 properties to any slider code
Ptyroutine Name(Get_uCloseIconName) Options(*REDEFINE)
#ReturnIconName := "fa-long-arrow-right"
Endroutine

* ---------------------------------------------------------------------------------
Ptyroutine Name(Get_uDockIconName) Options(*REDEFINE)
#ReturnIconName := "fa-thumb-tack"
Endroutine

* ---------------------------------------------------------------------------------
Ptyroutine Name(Get_uImageName) Options(*REDEFINE)
#ReturnImageName := "fa-angle-double-left"
Endroutine

Ptyroutine Name(Get_uImageSource) Options(*REDEFINE)

* Where T= Themed image - the ones that ship with VLF-ONE.
* Redefine that to return G (Google material design) or F (Font Awesome).
* This means all 3 images must come from Themed, Google or Font Awesome - you can't mix them up.
* Also, Google and Font Awesome names are case sensitive so they normally need to be quoted.

#ReturnImageSource := G
Endroutine

Ptyroutine Name(Get_uBorderStyle) Options(*REDEFINE)
#ReturnBorderStyle <= #Noborders
Endroutine

* -----------------------------------------------------------------------------------------------
Mthroutine Name(uInitialize) Options(*REDEFINE)
#COM_ANCESTOR.uInitialize

#Favorites.avFrameworkManager <= #AVFRAMEWORKMANAGER
#Favorites.uInitialize

Endroutine
* -------------------------------------------------------------------------
Mthroutine Name(uTerminate) Options(*REDEFINE)
#Favorites.uTerminate
#COM_ANCESTOR.uTerminate
Endroutine
End_Com
Favorites Panel components inside the slider

Code: Select all

* Components
Define_Com Class(#PRIM_LIST) Name(#Tree) Parent(#COM_OWNER) Width(417) Displayposition(1) Tabposition(1) Columnlines(False) Columnheaderheight(0) Rowheight(35) Height(500) Rowlines(False) Top(0) Left(0) Dragstyle(Automatic) Popup(#PopupMenuBar)

Define_Com Class(#PRIM_LIST.Icon) Name(#TreeIcon) Parent(#Tree) Displayposition(1) Columnwidth(85) Style(#Style1) Columnresize(False) Iconalignment(CenterLeft)
Define_Com Class(#PRIM_List.String) Name(#TreeNode) Parent(#Tree) Source(#STD_TEXTL) Displayposition(2) Columnwidth(300)
Define_Com Class(#PRIM_List.Number) Name(#TreeID) Parent(#Tree) Source(#STD_NUM) Displayposition(3) Columnwidth(300) Columnvisible(False)

Define_Com Class(#PRIM_List.String) Name(#TreeType) Parent(#Tree) Source(#STD_TEXTS) Displayposition(4) Columnwidth(300) Columnvisible(False)

Define_Com Class(#PRIM_List.String) Name(#TreeBusObj) Parent(#Tree) Source(#BUSOBJNML) Displayposition(5) Columnwidth(300) Columnvisible(False)
Define_Com Class(#PRIM_List.String) Name(#TreeCmdHdl) Parent(#Tree) Source(#CMDHDLNML) Displayposition(6) Columnwidth(300) Columnvisible(False)

Define_Com Class(#PRIM_PPNL.Menu) Name(#PopupMenuBar) Height(62) Width(125) Left(417)

Define_Com Class(#PRIM_PPNL.MenuItem) Name(#AddFolder) Caption('Add Folder') Displayposition(1) Tabposition(1) Width(123) Height(30) Parent(#PopupMenuBar)

Define_Com Class(#PRIM_PPNL.MenuItem) Name(#EditItem) Caption('Edit') Displayposition(2) Tabposition(2) Width(123) Height(30) Top(30) Parent(#PopupMenuBar)

Define_Com Class(#PRIM_PPNL.MenuItem) Name(#DeleteItem) Caption('Delete') Displayposition(3) Tabposition(3) Width(123) Height(30) Top(60) Parent(#PopupMenuBar)

I'm also using the prepare event for the popup menu to set the context.

Code: Select all

* --------------------------------------------------------------
Evtroutine Handling(#PopupMenuBar.Prepare) Continue(#Continue) Left(#Left) Top(#Top) Height(#Height) Context(#Context)

* Can only add folders/groupd to the root
If (#tree.CurrentItem.ParentItem *Is *NULL)
#AddFolder.Visible := True
#EditItem.Visible := False
#DeleteItem.Visible := False

#Height := #AddFolder.Height
Else
#AddFolder.Visible := False
#EditItem.Visible := True
#DeleteItem.Visible := True

#Height := #EditItem.Height + #DeleteItem.Height
Endif

* Position popup menu
#Left := #SYS_MOUSE.HorPosition + 25

If (#SYS_MOUSE.VerPosition + #PopupMenuBar.Height > #SYS_WEB.WebPage.Height)
#Top := #SYS_MOUSE.VerPosition - #PopupMenuBar.Height
Else
#Top := #SYS_MOUSE.VerPosition
Endif

#Context <= #Tree

#Continue := True
Endroutine

Again, if I pin the slider, the menu works great with the right click. when it's floating, the menu doesn't work. the prepare event also doesn't fire. that's why I was wondering if I could somehow maybe temporarily pin the slider and then unpin when the slider loses focus (or some other event). Or if there maybe some other trick
Slider Pinned.png
Slider Pinned.png (25.93 KiB) Viewed 52 times

Post Reply