Visibility of a grid
-
- Profound User
- Posts: 25
- Joined: Mon Sep 23, 2013 7:08 am
- First Name: ALIMA
- Last Name: SECK
- Company Name: OO2
- Contact:
Visibility of a grid
Hello, I have a tab panel with four tabs and a grid next, now I want my grid is displayed only if the third tab is selected.
I tried to said indicator visibility and a variable for the 'tab response' and manage in my program but I do not.
Does anyone have an idea?
I tried to said indicator visibility and a variable for the 'tab response' and manage in my program but I do not.
Does anyone have an idea?
-
- Profound User
- Posts: 64
- Joined: Thu Aug 04, 2011 4:53 am
- First Name: Karl
- Last Name: Fritz
- Company Name: Logic IT Services
- Address 1: Fluhgasse 141
- City: Laufenburg
- Zip / Postal Code: 5080
- Country: Switzerland
- Location: Switzerland
- Contact:
Re: Visibility of a grid
Hi,
I guess your grid will be displayed on all tabs and you are trying to prevent this by an indicator.
Do this:
1st, insert a "simple container layout" into your Tab3 Container and adjust the size. (see section Layouts)
2nd, insert now your grid into the "simple container layout" on Tab 3.
This should solve your issue. You don't need an indicator to hide the grid - except it's a function ;-).
Hope this helps,
Karl
I guess your grid will be displayed on all tabs and you are trying to prevent this by an indicator.
Do this:
1st, insert a "simple container layout" into your Tab3 Container and adjust the size. (see section Layouts)
2nd, insert now your grid into the "simple container layout" on Tab 3.
This should solve your issue. You don't need an indicator to hide the grid - except it's a function ;-).
Hope this helps,
Karl
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: Visibility of a grid
You shouldn't even need to put a simple container into the tab to make the grid hide/show as appropriate. Just dropping the grid into one tab will take care of it.
The problem could be that the grid has simply not been dropped into the tab properly. This can happen very easily if the grid was too large to fit, even slightly, when you tried to drop it in. In that case, you could adjust sizing so that it will fit in the tab, then pick it up and drop it into the tab again.
You can confirm it's working in the designer by just clicking through the tabs to see if it shows/hides as it should. If it does in the Designer, it would also at runtime.
The problem could be that the grid has simply not been dropped into the tab properly. This can happen very easily if the grid was too large to fit, even slightly, when you tried to drop it in. In that case, you could adjust sizing so that it will fit in the tab, then pick it up and drop it into the tab again.
You can confirm it's working in the designer by just clicking through the tabs to see if it shows/hides as it should. If it does in the Designer, it would also at runtime.
-
- Profound User
- Posts: 25
- Joined: Mon Sep 23, 2013 7:08 am
- First Name: ALIMA
- Last Name: SECK
- Company Name: OO2
- Contact:
Re: Visibility of a grid
I think you have not understood my question.
I say that the grid is not in the tab panel but completely right.
A display of my screen, I want the grid is displayed only if the third
tab is active
I say that the grid is not in the tab panel but completely right.
A display of my screen, I want the grid is displayed only if the third
tab is active
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: Visibility of a grid
You're right -- I did not get this from your original post. I understand now...
The first question, then, is to decide whether you want the switching of tabs to return control to your RPG program or not. By default, this does not happen, and the switching of tabs is done all in the browser. Binding 'tab response' to a field changes the behavior so that clicking on a tab will return control to your RPG program.
Which behavior did you want? The grid can be shown/hidden as needed with either scenario, but the technique is much different. If not returning control to RPG for the tab clicks then some JavaScript coding will be needed, otherwise it can be done entirely with RPG.
Let me know, and I can advise.
The first question, then, is to decide whether you want the switching of tabs to return control to your RPG program or not. By default, this does not happen, and the switching of tabs is done all in the browser. Binding 'tab response' to a field changes the behavior so that clicking on a tab will return control to your RPG program.
Which behavior did you want? The grid can be shown/hidden as needed with either scenario, but the technique is much different. If not returning control to RPG for the tab clicks then some JavaScript coding will be needed, otherwise it can be done entirely with RPG.
Let me know, and I can advise.
-
- Profound User
- Posts: 25
- Joined: Mon Sep 23, 2013 7:08 am
- First Name: ALIMA
- Last Name: SECK
- Company Name: OO2
- Contact:
Re: Visibility of a grid
i prefer that the switching of tabs is done all in the browser
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: Visibility of a grid
Ok, this is the more difficult way, and using this method will require knowledge of JavaScript coding, and also troubleshooting/debugging techniques if you have any issues. See our JavaScript API docs here for any further information beyond my example:
http://www.profoundlogic.com/docs/displ ... ipt+Coding
To do this, requires two bits of code.
1. First, of all, if the RPG program can output the screen when any other tab but the first is selected by default when the screen loads (through binding the 'active tab' property), then you'd need to make sure that the initial visibility of the grid is also set appropriately by RPG. So in your example, if the program outputs the screen with 'active tab' set to 2 (third tab), then it should also show the grid. Otherwise hide it. This can be done by simply binding an indicator to the grid's 'visibility' property and setting as appropriate in RPG before displaying the screen.
If you are not using 'active tab' (the tab panel will always have the first tab selected on initial screen load in this case), you can omit this step.
2. Then, use this JavaScript code to show/hide the grid in the tab panel's 'ontabclick' event property:
The JavaScript code works for sure -- I tested it using a grid with id 'Grid1', see the comments on that.
The alternative of doing this with submits back to RPG for the tab clicks would be:
1. Bind 'active tab' and 'tab response' on the tab panel to the same field. No need to do anything at all with this field in the RPG program, other than below.
2. Before any display of the screen, set the grid visibility indicator *On/*Off as needed by checking the 'active tab' / 'tab response' field to see if it's set to 2.
http://www.profoundlogic.com/docs/displ ... ipt+Coding
To do this, requires two bits of code.
1. First, of all, if the RPG program can output the screen when any other tab but the first is selected by default when the screen loads (through binding the 'active tab' property), then you'd need to make sure that the initial visibility of the grid is also set appropriately by RPG. So in your example, if the program outputs the screen with 'active tab' set to 2 (third tab), then it should also show the grid. Otherwise hide it. This can be done by simply binding an indicator to the grid's 'visibility' property and setting as appropriate in RPG before displaying the screen.
If you are not using 'active tab' (the tab panel will always have the first tab selected on initial screen load in this case), you can omit this step.
2. Then, use this JavaScript code to show/hide the grid in the tab panel's 'ontabclick' event property:
Code: Select all
// Tab number starts at zero, from the left.
// So, tab number two is the third tab.
// Pass the 'id' property of the grid widget to
// 'applyProperty()', exactly as given in the properties window.
// It's case sensitive...
if (tab == 2) {
applyProperty("Grid1", "visibility", "visible");
}
else {
applyProperty("Grid1", "visibility", "hidden");
}
The alternative of doing this with submits back to RPG for the tab clicks would be:
1. Bind 'active tab' and 'tab response' on the tab panel to the same field. No need to do anything at all with this field in the RPG program, other than below.
2. Before any display of the screen, set the grid visibility indicator *On/*Off as needed by checking the 'active tab' / 'tab response' field to see if it's set to 2.
-
- Profound User
- Posts: 25
- Joined: Mon Sep 23, 2013 7:08 am
- First Name: ALIMA
- Last Name: SECK
- Company Name: OO2
- Contact:
Re: Visibility of a grid
Thaks David for your helps, now it works.
-
- Profound User
- Posts: 37
- Joined: Tue Aug 27, 2013 7:34 am
- First Name: Seynabou
- Last Name: Gueye
- Company Name: Oo2
- Country: Senegal
- Contact:
Re: Visibility of a grid
Hello David,
I use this exemple to do the same thing.
But on the third tab, I have a button and when I click there I open an another screen and when I am go back to the panel, I am always on the third tab but the grid doesn't appear because the tab lost the focus.
I try to set the property "onfocus" of the tab using the same javascript code but it doesn't work.
Have you an idea about it?
I use this exemple to do the same thing.
But on the third tab, I have a button and when I click there I open an another screen and when I am go back to the panel, I am always on the third tab but the grid doesn't appear because the tab lost the focus.
I try to set the property "onfocus" of the tab using the same javascript code but it doesn't work.
Have you an idea about it?
- David
- Profound Logic Staff Member
- Posts: 690
- Joined: Fri Jan 04, 2008 12:11 pm
- First Name: David
- Last Name: Russo
- Company Name: Profound Logic Software
- Contact:
Re: Visibility of a grid
It's hard to tell what it could be without seeing your display. Although, I can tell you that 'focus' is not what you're looking for. When using a tab panel and you want to keep a certain tab active after submitting back to RPG, you'd want to bind a field to the 'active tab' property, then set to the appropriate tab number. This will cause the given tab number to be selected when the screen displays, and all content inside should then be visible.
If, however, you are doing exactly what was discussed in this thread and showing/hiding a grid that is OUTSIDE of a tab panel, then you'd need to bind an indicator to the grid 'visibility' property as discussed here, and set as appropriate.
If this doesn't help, do you mind posting an example here? An easy way to do this is to use Save As, and then the Local tab to save a copy to your PC.
You could delete any sensitive or irrelevant bits first, then attach here, along with any needed explanation.
If, however, you are doing exactly what was discussed in this thread and showing/hiding a grid that is OUTSIDE of a tab panel, then you'd need to bind an indicator to the grid 'visibility' property as discussed here, and set as appropriate.
If this doesn't help, do you mind posting an example here? An easy way to do this is to use Save As, and then the Local tab to save a copy to your PC.
You could delete any sensitive or irrelevant bits first, then attach here, along with any needed explanation.
Who is online
Users browsing this forum: No registered users and 11 guests