Menu

Posted: 2017-01-19 in 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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s