Subfile Context Menu Code Sample
-
- New User
- Posts: 19
- Joined: Fri Jan 09, 2015 5:21 am
- First Name: Patrice
- Last Name: Vincent
- Company Name: Saphir Systèmes
- Contact:
Subfile Context Menu Code Sample
Hi All,
I'm new to ProfoundUi, i would like to add a context menu to a subfile.
That way, i will copy the 2=Edit, 3=Copy, 4=Delete, 5=Show to a context menu.
So, when the user right click in a line, he can do these option with the mouse.
I dont have found an example of this in ProfoundUI examples, so if somebody has, it will help me.
I have read the posts but don't really understand how to create a widget...
Thanks !
Best regards,
Patrice
I'm new to ProfoundUi, i would like to add a context menu to a subfile.
That way, i will copy the 2=Edit, 3=Copy, 4=Delete, 5=Show to a context menu.
So, when the user right click in a line, he can do these option with the mouse.
I dont have found an example of this in ProfoundUI examples, so if somebody has, it will help me.
I have read the posts but don't really understand how to create a widget...
Thanks !
Best regards,
Patrice
Re: Subfile Context Menu Code Sample
Hello Patrice,
I can give you a quick example on how to create a context menu.
First thing to do is add the menu to your record format containing the grid. Set the 'context menu id' property of the Grid widget to the id of the added menu widget. Set the choices/values you would like to make available to the user in the menu widget. (If no values are set, the values in the 'choices' property are used) Hide the added context menu, by right-clicking the widget and selecting 'Hide'. Now the menu should be available when the grid is right-clicked.
I can give you a quick example on how to create a context menu.
First thing to do is add the menu to your record format containing the grid. Set the 'context menu id' property of the Grid widget to the id of the added menu widget. Set the choices/values you would like to make available to the user in the menu widget. (If no values are set, the values in the 'choices' property are used) Hide the added context menu, by right-clicking the widget and selecting 'Hide'. Now the menu should be available when the grid is right-clicked.
-
- New User
- Posts: 19
- Joined: Fri Jan 09, 2015 5:21 am
- First Name: Patrice
- Last Name: Vincent
- Company Name: Saphir Systèmes
- Contact:
Re: Subfile Context Menu Code Sample
Hi Scott,
Nice !!! Thank you very much for this example.
I'm going to try it !
Best regards,
Patrice
Nice !!! Thank you very much for this example.
I'm going to try it !
Best regards,
Patrice
- Glenn
- Profound Logic Staff Member
- Posts: 124
- Joined: Mon Apr 14, 2014 4:08 pm
- First Name: Glenn
- Last Name: Hopwood
- Company Name: Profound Logic Software
- State / Province: Ohio
- Country: United States
- Contact:
Re: Subfile Context Menu Code Sample
Patrice,
To expand on Scott's reply. There is some fairly simple JavaScript you can use to put the clicked context menu option into your onscreen (or hidden) option field and submit the screen.
First you would put some code in the 'onrowclick' property of your grid (Note the button to the right of the area where you enter text. You can click that to get a context sensitive text editor). Here's the code:
This code puts the row that the user clicked into a property of the context menu named "user defined data" (note that you should change the text in the <> symbols to the id of your context menu).
You would then put some code in the 'onoptionclick' property of your context menu (Note that this image shows our text editor that is launched when you press the button mentioned above). Here's the code:
This code pulls the row that the user clicked out of the property it was put in by the previous code and concatenates it with the field name of your option field. It then uses our pui.click() function to submit it back to the server.
If you are converting existing green screens, all of this can be done automatically by options available in our Conversion Themes (see this blog post http://www.profoundlogic.com/blog/dds-c ... ents-ibmi/).
Glenn
To expand on Scott's reply. There is some fairly simple JavaScript you can use to put the clicked context menu option into your onscreen (or hidden) option field and submit the screen.
First you would put some code in the 'onrowclick' property of your grid (Note the button to the right of the area where you enter text. You can click that to get a context sensitive text editor). Here's the code:
Code: Select all
applyProperty("<ID property of your context menu>","user defined data",row);
You would then put some code in the 'onoptionclick' property of your context menu (Note that this image shows our text editor that is launched when you press the button mentioned above). Here's the code:
Code: Select all
var rowClicked = this.pui.properties["user defined data"];
pui.set("<Name of option field in your grid>." + rowClicked, value);
pui.click();
If you are converting existing green screens, all of this can be done automatically by options available in our Conversion Themes (see this blog post http://www.profoundlogic.com/blog/dds-c ... ents-ibmi/).
Glenn
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Subfile Context Menu Code Sample
This is a very nice explanation, guys. I wonder if we should put it in our documentation somewhere?
-
- New User
- Posts: 19
- Joined: Fri Jan 09, 2015 5:21 am
- First Name: Patrice
- Last Name: Vincent
- Company Name: Saphir Systèmes
- Contact:
Re: Subfile Context Menu Code Sample
Hi Guys,
Thanks very much for your precious help.
i will try all and give you feedback.
Really nice !
Patrice
Thanks very much for your precious help.
i will try all and give you feedback.
Really nice !
Patrice
-
- New User
- Posts: 19
- Joined: Fri Jan 09, 2015 5:21 am
- First Name: Patrice
- Last Name: Vincent
- Company Name: Saphir Systèmes
- Contact:
Re: Subfile Context Menu Code Sample
Hi Guys,
With your help, i succeed in creating a menu on a subfile.
To make it clear for others, the first part is to create a menu (Scott Wagers gave us screen copy of that).
At this stage, the menu is clicable but nothing is done when you select something.
To make the link beetween your subfile and this menu, you need to do what Glenn explain in the next part, the javascript code.
This code permit the system to put when you right click on the subfile the line number of your subfile (to know where to return information) in a variable, then call the menu and return your choice with the line number. This way, your otion (where normaly the user put 2, 3, 4 ... is completed).
I have a question to support team, i have tried to avoid javascript to only use the "menu response" zone of the menu. (Like a selectbox).
In that zone, i have put the same name as my subfile option :
ex :
Subfile Menu
ZCHOIX NAME ADRESS .... Menu response=ZCHOIX
ZCHOIX NAME ADRESS ....
ZCHOIX NAME ADRESS ....
ZCHOIX NAME ADRESS ....
With that, i have no error but my subfile is not impacted (i think because i haven't the raw number).
Is there a simple way to do that or are we obliged to use javascript ?
Thanks a lot for your help,
Patrice
With your help, i succeed in creating a menu on a subfile.
To make it clear for others, the first part is to create a menu (Scott Wagers gave us screen copy of that).
At this stage, the menu is clicable but nothing is done when you select something.
To make the link beetween your subfile and this menu, you need to do what Glenn explain in the next part, the javascript code.
This code permit the system to put when you right click on the subfile the line number of your subfile (to know where to return information) in a variable, then call the menu and return your choice with the line number. This way, your otion (where normaly the user put 2, 3, 4 ... is completed).
I have a question to support team, i have tried to avoid javascript to only use the "menu response" zone of the menu. (Like a selectbox).
In that zone, i have put the same name as my subfile option :
ex :
Subfile Menu
ZCHOIX NAME ADRESS .... Menu response=ZCHOIX
ZCHOIX NAME ADRESS ....
ZCHOIX NAME ADRESS ....
ZCHOIX NAME ADRESS ....
With that, i have no error but my subfile is not impacted (i think because i haven't the raw number).
Is there a simple way to do that or are we obliged to use javascript ?
Thanks a lot for your help,
Patrice
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Subfile Context Menu Code Sample
I think the "menu response" property is for when you use the menu as a "regular" menu. i.e., if you're writing a screen whose purpose is to be a menu where the user selects an option.
I don't think you can use "menu response" when a menu is used as a context menu of a subfile, for that you need to use the JavaScript technique that Glenn posted.
I don't think you can use "menu response" when a menu is used as a context menu of a subfile, for that you need to use the JavaScript technique that Glenn posted.
-
- Profound User
- Posts: 62
- Joined: Sat Feb 18, 2012 12:03 pm
- First Name: Patrick
- Last Name: THOMAS
- Company Name: Oo2
- Country: France
- Contact:
Re: Subfile Context Menu Code Sample
And how to put an image behind the options like this ?
Thank you
Thank you
- Brian
- Profound Logic Staff Member
- Posts: 286
- Joined: Thu Apr 14, 2011 10:23 am
- First Name: Brian
- Last Name: May
- Company Name: Profound Logic Software
- Contact:
Re: Subfile Context Menu Code Sample
You can embed HTML in the Choices property of the menu widget. So for example if I set my Choices property to the following:
<img src="/img/accept.png"> Option 1,Option 2,Option 3,Option 4,Option 5
It would look like this:
<img src="/img/accept.png"> Option 1,Option 2,Option 3,Option 4,Option 5
It would look like this:
Who is online
Users browsing this forum: No registered users and 9 guests