Menu

Q:
How to enable and disable the Menu buttons“. Like “fieldXY.enable = false;
A:
Lianja.getElementByID(“page.section”).menu is exposed on the Desktop client only (Lianja/VFP), you can’t currently modify the Section custom menu options in JavaScript code for Web Apps.


to have the menu show as hyperlinks, prefix with ! as in !a,b,c

to have the menu show as buttons, prefix with # as in #a,b,c


Q:
I have created a menu footer by specifying the “custom menu” attribute in “Footer” section as below

#Prior,Next,Leave Records,Return

This will create 4 command buttons for me

May I know how can I tie actions to each of the footer menu actions?
A:
Custom footer menu delegate in the Advanced section of the Section delegates:


In a custom section you have the ability to add a toolbar and add items to the toolbar.

One of the items you can add is a flat button with a menu attached to it.

For those people who’s architecture calls for it, you can use the menus to open pages using showdialog().

Here is a simple screenshot to illustrate what I am referring to.

I’ll build a small sample application in the next day or two to pass along.


I created a toolbar with three menu options.

Each one opens a different non modal window.

What would be nice is to have the main Lianja window be only the size just larger than the Toolbar, or to specify the showdialog() in window. Either one would work.

But in any case, Lianja can clearly run multiple applications at the same time if that is something you have to have.

Code:
define class mytoolbar as toolbar
       
        proc click(plabel)
               
                if  alltrim(plabel) ="Show 1"
                                Lianja.showDialog("Customer Data","form1",500,500,.F.,.F.,.F.)
                endif
               
                if  alltrim(plabel) ="Show 2"
                        Lianja.showDialog("Customer map","customers",500,500,.F.,.F.,.F.)
                endif
               
                if  alltrim(plabel) ="Show 3"
                Lianja.showDialog("Customer list","customerlist",500,500,.F.,.F.,.F.)
                endif
        endproc 
       
enddefine



Q:
how to create submenu (level2 and 3) in a form.
I can only create a 1level menu using the option “custom menu” of the form. For example Fichiers(Juridiction|Confrere|Client|Affaire|Dossi er|Honoraire|Documents|Audience).
What is I want to add 2 submenus for menu item like Client in this example?
A:
Lianja menus are fairly simplistic.
You can only have 1 level submenu and as soon as a submenu is added, if you have keyboard shortcuts (ex. &Help), they will not work.

Menu item are separated by a comma.
Submenus are created in parentheses.

Here is an example with 2 menu items and one sub level.

Configurations,Help(About)
A2:
Lianja is very flexible in that you can approach issues from different directions.
If you have the need to create menus with many nested layers, you may want to look at adding a webview section on top of your form section and use bootstrap or jquery for the menu.

I did a demo that sort of covered this some time back.

Lianja and Pinegrow part 1 – https://www.youtube.com/watch?v=DlEHGGe00VA
Lianja and Pinegrow Bootstrap Part 2 – https://www.youtube.com/watch?v=PGmVEP_YwrI

In this case I was using a third party product to copy and past the code, but you can easily find examples on the web.

Additionally, you can try the Jquery UI menu.

https://jqueryui.com/menu/

Check out the example_jquery app that comes with Lianja.

Note – Last I looked, pinegrow was using bootstrap 3.3.4,so just be aware in case you want to go that route.

1 – create a Jquery menu (just copy it from the Jquery page)
2 – Save it as an RSP page.
3 – Set it as your custom menu panel.

Since at this time, I cant get it to overflow the form items, I set the height of the panel to 250 and set visble to false.

Then I set the custom search Icon to visible on the section.
In the custom search command delegate, I use the following code.

Code:
proc page1_section1_customsearch()
if Lianja.get("page1.section1").menuvisible = .t.
Lianja.get("page1.section1").menuvisible =.f.
else
Lianja.get("page1.section1").menuvisible = .t.
end

endproc

So this will allow you to use Jquery menu to nest as many options as you like in section menu. Not the greatest solution, I know, but it will work.




Q:
How to enable and disable the Menu buttons”. Like “fieldXY.enable = false;” ???
A:
Enabling / disabling custom section menu items is not possible in this concept.
It is intended to use a string written in Section Attributes: Menu | Custom menu , like…:

Code:
Contacts,Reset,Filter(All|Sales|Owner|Marketing|Accounting),Navigate(First|Previous|Next|Last),Reports(High Credit Customers|Over Credit Limit|Customer List),Search,Map

…and to deal with actions by code in

Section Attributes: Custom delegates | Custom section menu.

This is quite static. You can only programatically write new string in Custom menu and refresh section.
And need to be sure that you have mentioned all possible cases in your delegate code. But, as Yvonne said, works only in desktop app.



 

Advertisements

Menu

The ‘Context menu‘ attribute is a comma-separated list, e.g.

Code:
Menu1,Menu2,Menu3

The ‘Context menu’ delegate is called when you select a menu option and the name of the menu option is passed to the delegate.

Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'contextmenu' event
proc page1_contacts_field1_contextmenu(action)
        messagebox(action)
endproc

The Context Menu is displayed when you right-click on a field in Edit mode (inline edit or full section or page edit).
The Context Menu is a single level menu, but you can have multiple options.


 

Code:
////////////////////////////////////////////////////////////////
// Event delegate for 'click' event
proc Customers_section2_click()
        Lianja.get("customers.section2").footermenu = '|&{iif(orders.freight > 100.00, "Reject", "Accept")}'
endproc

The & character is used for hot key shortcuts (http://www.lianja.com/community/show…highlight=menu), but you can use {} in the menus.





Desktop/Web/Mobile now handle iOS/Android footer menus and section menus now handle iOS style tab buttons too (prefix with # just like footer menus).
See below. This is fully responsive no matter what screen resolution or device it is rendered on.


Q:
I have created a menu footer by specifying the “custom menu” attribute in “Footer” section as below
#Prior,Next,Leave Records,Return
This will create 4 command buttons for me
May I know how can I tie actions to each of the footer menu actions?
A:
Custom footer menu delegate in the Advanced section of the Section delegates:

The delegate is simply called with the caption of the menu button so add an arg to your delegate proc and then compare the arg and act accordingly.


Q:
Is there a way to add additional actions on the section action toolbar or the page action toolbar for all my pages in my app?
For example, if I want a “Copy” or “Export” actions on top of the default “Add”,”Edit”,”Delete”,”Next”, etc actions
A:
You can use the section menu or the section footer menu to do that.


Q:
How is the menues (MNT and MPR) VFP uses?
A:
Use of these is deprecated and discouraged in Lianja as they are specific to VFP and are desktop bound.
Use the section menus or section footers in place of these old FoxPro menus.