Previous Thread
Next Thread
Print Thread
Dialog Focus Problem #29698 12 Mar 07 02:10 PM
Joined: Sep 2002
Posts: 5,450
F
Frank Online Content OP
Member
OP Online Content
Member
F
Joined: Sep 2002
Posts: 5,450
I'm not sure if this is new as of (984.0) but this used to work:

In out app toolbar, i have icons to access the windows calculator and Calendar... Now what happens is when launching and closing them, the focus of ATE goes back to the ATE desktop, and not the program that was active... giving the impression that the program is locked. Also, sometimes they launch behind the ATE desktop.

Here is the code that used to work... this is under XP/Sp2. I can add code to make this work, or let me know what can be done. Thanks.

Code
!------------------------------------------------------------------------!     
! Displays Windows Calculator                                                  
!------------------------------------------------------------------------!     
GUI'CALCULATOR:                                                                
        ?TAB(-10,23);"CALC.EXE";CHR(127);                                      
        XCALL GOT,TOSS$                                 ! Toss return key      
        RETURN                                                                 
                                                                               
!------------------------------------------------------------------------!     
! Displays Windows Calendar.                                                   
!------------------------------------------------------------------------!     
GUI'CALENDAR:                                                                  
        ?TAB(-10,23);"RunDLL32.EXE shell32.dll,Control_RunDLL timedate.cpl";CH 
        XCALL GOT,TOSS$                                 ! Toss return key      
        RETURN                                                                 
                                                                               

Re: Dialog Focus Problem #29699 12 Mar 07 02:32 PM
Joined: Sep 2003
Posts: 4,135
Steve - Caliq Offline
Member
Offline
Member
Joined: Sep 2003
Posts: 4,135
I’ve had a few reports from customer on ATE focus (and prior to 984.0) they have been things like:

In ATE, Launch Word, (do what ever) Close Word, the focus is now back on the Desktop and not ATE.

I’ve never been 100% able to reproduce the problem, and im sure this is more do to with the operating system, stack, users..etc than ATE itself.


I tried your example Frank:

I created a one line program:
?TAB(-10,23);"CALC.EXE";CHR(127);

and CALC launches and then returns back to ATE fine (in this case the dot prompt), its not a 100% test of what your doing, but it does prove its returning back to ATE.

Re: Dialog Focus Problem #29700 12 Mar 07 03:17 PM
Joined: Sep 2002
Posts: 5,450
F
Frank Online Content OP
Member
OP Online Content
Member
F
Joined: Sep 2002
Posts: 5,450
Thanks for the re-try, Steve... Can you try it from a dialog? The problem isn't that ATE doesnt regain focus, but the focus drops back to the ATE desktop, and not the last dialog of focus...

PS: How was the GUINESS Marmite? wink

Re: Dialog Focus Problem #29701 12 Mar 07 07:14 PM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
I think I've reproduced the problem. Not sure what has changed, if anything (seems to be highly dependent on the spin level of the pixeltrons in the outer orbital), but I'll see if something can be done.

Re: Dialog Focus Problem #29702 12 Mar 07 07:41 PM
Joined: Sep 2002
Posts: 5,450
F
Frank Online Content OP
Member
OP Online Content
Member
F
Joined: Sep 2002
Posts: 5,450
... i was going to say that... wink

Re: Dialog Focus Problem #29703 12 Mar 07 08:45 PM
Joined: Sep 2003
Posts: 4,135
Steve - Caliq Offline
Member
Offline
Member
Joined: Sep 2003
Posts: 4,135
Sounds like the Universal is all in tacked and no more testing is needed here, so im calling it a night.

And Frank, yes the extraordinary uncommon GUINESS Marmite was very yummy! (a little creamer and not so strong)

(and for everyone wondering what Franks on about, we have www.marmite.com over here in the UK, you may/may not of come across it, great for breakfast on toast, any way they have created 300,000 special Guiness Marmites! but, they selling like hot cakes and most are ending up on ebay for 5 times the prices, but lucky, after a little searching I found our local supermarket had a few tubs for the normally price, your love it or hate it! Trust me.)

Re: Dialog Focus Problem #29704 13 Mar 07 04:37 AM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
OK, I think this was changed in 982.8, indirectly, when I added the waitflag=2 feature to TAB(-10,AG_SHLEXEC), to try to get the focus back to A-Shell after launching another application.

However, it was never really established who should get the focus when using TAB(-10,AG_WINEXEC) (i.e. TAB(-10,23)), unless the job is being launched in background.

If it matters who gets the focus after the launch (and if you want to be more compatible with Vista), I recommand changing your TAB(-10,23) to TAB(-10,24), i.e. from TAB(-10,AG_WINEXEC) to TAB(-10,AG_SHLEXEC). By default, that will put the focus on the launched application, but you can force it to put the focus back on A-Shell by setting the waitflag=2:

Code
! This will leave focus on calculator:
? tab(-10,AG_SHLEXEC);"CALC.EXE";chr(127);
!
! This will get focus back on A-Shell:
? tab(-10,AG_SHLEXEC);"CALC.EXE,,,,,2";chr(127);

  
(Those 5 commas between the executable and waitflag (2) at the end are to default the four intermediate parameters: action, parms, dir, showflags.)

See Shell Execute in the Development Guide for more details.

By the way, the 984.2 patch (ashw32.exe) fixes the problem with the focus getting put on the A-Shell or ATE background window rather than on the current dialog. But unless you switch to AG_SHLEXEC from AG_WINEXEC, it will be hit-or-miss whether A-Shell or the launched application ends up with the focus.

Re: Dialog Focus Problem #29705 13 Mar 07 06:22 AM
Joined: Sep 2002
Posts: 5,450
F
Frank Online Content OP
Member
OP Online Content
Member
F
Joined: Sep 2002
Posts: 5,450
Jack, i havent had time to grab 984.2 yet, but did give the -10,24 a try, and it seems to work with the calculator fine, but trying to launch the calculator yields this error:

"Windows cannot find RUNDLL32.EXE shell32.dll"

It does however work with -10,23

What do you recommend?

Re: Dialog Focus Problem #29706 13 Mar 07 09:53 AM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
The problem here is that the syntax for TAB(-10,24) is slightly different. Rather than passing the entire command line as a single string, you have to put the executable (or other object specification) in the first parameter (objecspec), and the rest of the command line in the third parameter (parms). So the syntax would have to become:

Code
?TAB(-10,24);"RunDLL32.EXE,,""shell32.dll,Control_RunDLL timedate.cpl"",,,2";chr(127);
xcall GOT,TOSS$
  
Note that because there is a comma in the argument list, we have to wrap it with an additional set of quotes. Also, note that the last three commas and "2" on the end are optional but added there to grab the focus back. Otherwise the focus is likely to remain on the launched app. (The two skipped parameters are the startup directory and showflags, both of which can be defaulted.)

Re: Dialog Focus Problem #29707 13 Mar 07 10:04 AM
Joined: Jun 2001
Posts: 11,645
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,645
Or, if you find the above syntax a bit cryptic, you can use the more straightforward MIAMEX equivalent:

Code
++include ashinc:ashell.def

map1 status,f
map1 action$,s,10,""  ! default action
map1 waitflag,b,1,2   ! get focus back
map1 dir$,s,10,""     ! default directory

xcall MIAMEX, MX_SHELLEX, status, "RunDLL32.EXE", action$, &
    "shell32.dll,Control_RunDLL timedate.cpl", &
    dir$, SW_SHOWNORMAL, waitflag

if status # 0 then call launch'error    
END

  
MX_SHELLEX (96) works with ATE, and doesn't require you to do the input operation (since the result code comes back in the status parameter). The status information is also more detailed (than the mere success/failure you get with the TAB(-10,24) form).

Re: Dialog Focus Problem #29708 13 Mar 07 11:58 AM
Joined: Sep 2002
Posts: 5,450
F
Frank Online Content OP
Member
OP Online Content
Member
F
Joined: Sep 2002
Posts: 5,450
Thanks for clarifying, Jack. It seems to work much better now.... even w/o the ashell update.


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3