cancel
Showing results for 
Search instead for 
Did you mean: 

2 Pop-up windows in 1 WD application

Former Member
0 Kudos

Hello,

I have 2 pop-up windows in 1 WD application. I have 2 questions regarding this:

1. The first pop-up window say XWIN has 3 inputfields and when the pop-up is called the focus is in the first field. The problem is in the second pop-up window say YWIN which has 1 inputfield this field has no focus even after requesting it. The question is can you not use 2 different pop-up windows in 1 WD Application? Why does the inputfield in YWIN does not get the focus??

2. I would to like make use of these 2 pop-up windows reusable in different WD's How do I do that with DC's?

Many thanks,

Dharmi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Dharmi,

You need to destroy the existing popup and then open the second window.

Regards, Anilkumar

Former Member
0 Kudos

Dharmi,

I have solved such a problem in the following manner.i am not sure if it is what you are looking for.

I have in total 3 views out of which 2 views i used them as popup views.

I have created 2 windows.One window has 2 popup views.

From the main window view i call the popup window view using IWDWindowInfo.From that popup view using plugs i go to another popup view but remember i have only one view active in the window all the time.

As Anilkumar said ,have to destroy the pop up view to get the conttrol back.I have used the context element to save the instance of Window to use before destroy the correct window.

Former Member
0 Kudos

Hello Baskaran and Anil,

Thank you for your reply. This is not something I am looking for. Looking at the secnario you mentioned, I have 3 windows and out of which 2 windows XWIN and YWIN are for the popups. The popups are not called within each other. They are 2 different popups and have nothing to do with each other.

I am also using destroy, saving the instance of the window, also requesting focus in the wdDoModifyView. The popups are working fine. It is just that I dont receive the focus in second popup inputfield. There is something missing but what!!!

Regards,

Dharmi

Former Member
0 Kudos

Hello All,

This topic is still open......

I have not been able to find out the reason why the second pop-up would not get the focus. It does not get focus even if it is the first pop-up that is open!

I look forward to reply!

Many thanks,

Dharmi

thomas_chadzelek
Participant
0 Kudos

Hello Dharmi,

I would like to learn more about your application. I guess you use the same mechanism to open both of these popups and to place the focus into them. Still it works only for the one, but not for the other.

Let's first concentrate on how you request the focus. How does your code for that look like? When do you call it? Do you issue more than one focus request in the same roundtrip (request/response cycle)?

Best regards,

Thomas

Former Member
0 Kudos

Hello Thomas,

Thank you for trying to help out. Please find in below the answers to your questions:

1. how you request the focus? How does your code for that look like? When do you call it?

-


ANSWER-----

This is the code for the first popup which is in the - XWIN

public static void wdDoModifyView(IPrivateDebtorView wdThis, IPrivateDebtorView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if (firstTime)

{

IWDInputField l_field = (IWDInputField)view.getElement("Naam");

l_field.requestFocus();

}

//@@end

}

Below is the code for the second pop-up which is in the YWIN

if (firstTime)

{

IWDInputField l_field = (IWDInputField)view.getElement("Desc");

l_field.requestFocus();

}

2. Do you issue more than one focus request in the same roundtrip (request/response cycle)?

-ANSWER-

NO not in the pop-up's but the calling application does have more than one focus request.

Best regards,

Dharmi

thomas_chadzelek
Participant
0 Kudos

Hello Dharmi,

I assume that neither of the input fields ("Naam", "Desc") is contained in a table.

Is it possible that the calling application requests the focus at the same time as the popup does? Then it would be unspecified which one wins. Which could mean Web Dynpro tries to focus some element in the window under the popup. And that, of course, would mean that the focus request in the popup fails. To me, that would be the easiest explanation to your problem.

Best regards,

Thomas

Former Member
0 Kudos

Hello Thomas,

Your assumption is right. You have a good point here -> "Is it possible that the calling application requests the focus at the same time as the popup does?"

What i actually do in the calling application is ; I have a value attribute in the context -> "FocusField" in this i set the name of the element which requires the focus and after requestfocus i set it to null. Please have look at the code below for a clear idea:

//set focus to particular inputfields mentioned in the getFocusField

if (wdContext.currentContextElement().getFocusField() != null)

{

if (wdContext.currentContextElement().getFocusField().equalsIgnoreCase("ContactId")== true)

{

IWDDropDownByKey l_dropdown = (IWDDropDownByKey)view.getElement("ContactId");

l_dropdown.requestFocus();

wdContext.currentContextElement().setFocusField(null);

} else {

IWDInputField l_fld = (IWDInputField)view.getElement(wdContext.currentContextElement().getFocusField());

l_fld.requestFocus();

wdContext.currentContextElement().setFocusField(null);

}

}

Hope the above is clear.

Regards,

Dharmi

thomas_chadzelek
Participant
0 Kudos

Hello Dharmi,

if you disable all other focus requests and just keep the one for YWIN active, does it work then?

If yes, then your code must take care not to issue multiple, contradictory focus requests.

If no, then when do you open those popups? Is there any difference between XWIN and YWIN? Does it work if you open the YWIN initially (although that might not make sense in your business scenario)?

Best regards,

Thomas

Former Member
0 Kudos

Hello Thomas,

Hurray it works, if I disable all other focus.....

But tell me one thing, after requestingfocus I always use to set the inputfield to null so no new focus is requested and still there is contradictory focus request I dont quite understand this??

FYI, There is difference between XWIN and YWIN there is a possibility that XWIN is not opend and YWIN would be the first opend pop-up but at that point also it did not work.

Now I would have to check why the inputfield after setting to null would not work!

Many thanks,

Dharmi

PS. 10 points for solving my problem. Do you have any idea how could I reuse this 2 pop-ups in my other WD application?

thomas_chadzelek
Participant
0 Kudos

Hello Dharmi,

for reusing something, you must make a component out of it. In your case I could imagine a component with two windows, one for each popup. Something along that line.

You also might need to make it a separate project/DC in order to reuse it from other projects/DCs.

Have a nice weekend,

Thomas

Former Member
0 Kudos

Hello Thomas,

Hope you had a nice weekend.

Thanks again for your help. "You also might need to make it a separate project/DC in order to reuse it from other projects/DCs." If I make a separate project would not be that more like Intra application navigation??? (I mite be wrong) but If I am correct then the functionality of pop-ups does not work as desired.

FYI, The 2 pop-up are serving as search functions (same like ovs)any search result selected on the pop-up it's details are displayed on the calling window view.

Best regards,

Dharmi

thomas_chadzelek
Participant
0 Kudos

Hello Dharmi,

I guess we agree that a Web Dynpro component is the unit of reuse. Your calling app would embed a component capable of opening a popup.

Whether that component is in the same or another DC should not make a difference for the popup. But I guess it makes a difference for the question who can reuse this thing (key word: project dependencies).

Best regards,

Thomas

Answers (0)