ASL Requesters coming up behind parent window

This forum is for general developer support questions.
Post Reply
colinward
Beta Tester
Beta Tester
Posts: 8
Joined: Sun Jan 06, 2013 9:29 am

ASL Requesters coming up behind parent window

Post by colinward »

Hello.

I have a program that opens an ASL file requester using the following code snippets (only partially displayed for clarity):

struct TagItem Tags[] = { { ASLFR_Window, (ULONG) m_poWindow }, ...};

Requester = IAsl->AllocAslRequest(ASL_FileRequest, Tags);
IAsl->AslRequestTags(Requester, TAG_DONE);

The variable m_poWindow contains a pointer to my Intuition window (which was originally opened with Reaction). The Window exists on its own screen. When I call this code, the ASL requester opens on top of the window as expected. Now it gets a little more complex.

If my program is running and I execute a second copy of it from a command line (or Workbench) then the second copy detects the first copy and sends an Exec message to the first copy telling it open the requester. In response, the first copy brings itself to the front and then calls the same code as above. Here is an extract:

IIntuition->ScreenToFront(m_poWindow->WScreen);

Requester = IAsl->AllocAslRequest(ASL_FileRequest, Tags);
IAsl->AslRequestTags(Requester, TAG_DONE);

Now the problem that I have is that most (90%) of the time, the ASL requester comes up *behind* the parent Window!

Originally I was using the ASLFR_Screen tag with a pointer to my custom screen to open my ASL requester. I thought that this was the problem so I changed to using the ASLFR_Window tag with the parent window, but the ASL requester still comes up behind the window! I also tried bringing the window to the front before I open the ASL requester using IIntuition->WindowToFront() but this does not make a difference. I have tried every combination of flags that I can think of for the ASL requester but it is always the same. It works if this is the first instance of the program that is executing - but not when the ASL requester is opened in response to the Exec message.

The fact that it works 10% of the time leads me to think that I have found some sort of race condition in Intuition or Reaction. I would post a message on the Beta mailing list but my Internet connection is broken so I will post it here. If anyone fro the OS4 team would like to investigate this problem then I can supply a binary and instructions on how to reproduce the issue.
User avatar
thomasrapp
Posts: 310
Joined: Sat Jun 18, 2011 11:22 pm

Re: ASL Requesters coming up behind parent window

Post by thomasrapp »

ScreenToFront does not rearrange windows. It just brings the screen to front with all its contents as it is.

AslRequest opens a new window. New windows are alway in front.

Therefore there must be something else in your program which causes your app window to jump in front of the asl window.

Perhaps your window has WA_StayTop set?
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 12:06 am

Re: ASL Requesters coming up behind parent window

Post by xenic »

@colinward
Have you tried setting the ASLFR_PopToFront tag to TRUE?
AmigaOne X1000 with 2GB memory - OS4.1 FE
Post Reply