Page 1 of 1

xBrowse to Excel how to bring ON TOP ?

Posted: Wed Jun 05, 2013 12:59 pm
by ukoenig
Hello,

1. I have a browser inside a FOLDER.
2. a print and EXCEL-button from the main-dialog.

The report is shown on top but it is impossible, to bring EXCEL on top.

Image

how to bring EXCEL on top ?

@ 245, 240 BTNBMP oBtn2 OF oDlg ;
SIZE 50, 25 PIXEL;
NOBORDER ;
PROMPT "&Excel " ;
ACTION IIF( oFld:nOption = 1, oBrw1:ToExcel(,1), oBrw2:ToExcel() ) ;
FILENAME c_path1 + "Excel.Bmp" ;
FONT oFont1 2007 ;
LEFT
oBtn2:lTransparent := .t.
oBtn2:cToolTip = { "Export " + CRLF + "to EXCEL","EXPORT", 1, CLR_BLACK, 14089979 }
oBtn2:SetColor( 0, )


Defined inside a FOLDER-page. oBrw1 is STATIC

@ 30, 30 XBROWSE oBrw1 SIZE 265, 173 PIXEL OF oFld:aDialogs[ 1 ] ;
COLUMNS 1, 2, 3, 4, 5, 6, 7, 8 ;
HEADERS "CHR","ASC", "CHR","ASC", "CHR","ASC", "CHR","ASC" ;
COLSIZES 50, 50, 50, 50, 50, 50, 50, 50 FONT oFont1 ;
ARRAY aPrint1 LINES FASTEDIT CELL

oBrw1:lHScroll := .F.

WITH OBJECT oBrw1
:nEditTypes := EDIT_GET
:CreateFromCode()
END
I := 1
FOR I := 1 to 8
oBrw1:aCols[ I ]:nDataStrAlign := AL_CENTER
NEXT


Best Regards
Uwe :?:

Re: xBrowse Excel only shown iconized ?

Posted: Wed Jun 05, 2013 1:26 pm
by Jeff Barnes
Hi Uwe,

I don't know if this will help but....

This is per the Microsoft Knowledge Base article #886217:
(Fix the New Program Window so that an Office program will automatically come to the front when launched.)
To resolve this issue, modify the value of the ForegroundLockTimeout registry entry in Registry Editor. To do this, follow these steps:
1 Click the Start Orb, click Run, type regedit in the Open box, and then click OK.
2 In Registry Editor, locate and then click the following registry subkey: HKEY_CURRENT_USER\Control Panel\Desktop
3 In the right pane, locate and then double-click ForegroundLockTimeout.
4 Under Base, click Decimal, type 0 in the Value data box, and then click OK. Note The default decimal value for the ForegroundLockTimeout registry entry is set as 200000.
5 Quit Registry Editor.
6 Restart your computer.
*This must be done for each User Account on the system.

Re: xBrowse Excel only shown iconized ?

Posted: Wed Jun 05, 2013 1:46 pm
by ukoenig
Hello Jeff,

Thank You very much. I will test it.
In METHOD To Excel there is a BringWindowToTop, but doesn't work in my situation.

METHOD ToExcel( bProgress, nGroupBy, aCols ) CLASS TXBrowse
...
...
oExcel:ScreenUpdating := .t.
oExcel:visible := .T.
ShowWindow( oExcel:hWnd, 3 )

BringWindowToTop( oExcel:hWnd )

return oSheet

Best Regards
Uwe :lol:

Re: xBrowse to Excel is only shown iconized ?

Posted: Thu Jun 06, 2013 9:52 am
by ukoenig
Jeff,

the key didn't exist in my registry.
I added the values, but there is no difference.

Tested with sample :

Image

Best regards
Uwe :?:

Re: xBrowse to Excel is only shown iconized ?

Posted: Thu Jun 06, 2013 12:08 pm
by Richard Chidiak
Uwe

Try

oExcel:Visible := .T.

without all the rest , it should be enough

Richard

Re: xBrowse to Excel how to bring ON TOP ?

Posted: Thu Jun 06, 2013 1:32 pm
by ukoenig
Richard,

In class TXBrowse
METHOD ToExcel( bProgress, nGroupBy, aCols )
ToTop is included, but Excel moves behind the window or dialog

defined in class TXbrowse

oExcel:ScreenUpdating := .t.
oExcel:visible := .T.
ShowWindow( oExcel:hWnd, 3 )

BringWindowToTop( oExcel:hWnd )

Best regards
Uwe :?:

Re: xBrowse to Excel how to bring ON TOP ?

Posted: Wed Jun 19, 2013 2:41 pm
by TecniSoftware
I have the same problem with excel, try this, working for me

oBrw:ToExcel()
SysRefresh() // Add this line
BringWindowToTop( FindWindow( 0, "Microsoft Excel - Libro1" ) ) // Add this line, traslate to english ( "Microsoft Excel - Book1" or something like this )


Best Regards

Re: xBrowse to Excel how to bring ON TOP ?

Posted: Thu Jun 20, 2013 2:18 am
by hua
I use this

Code: Select all

  .
  .
SetFocusAfter(FindWindow( "XLMAIN", 0 ))
return nil
//---------------------------------------------------
function SetFocusAfter(hWnd)
 local oTimer
 define timer oTimer interval 500 of oWnd    ;
   action (BringWindowToTop(hWnd), oTimer:DeActivate())

 activate timer oTimer
return Nil
 

Re: xBrowse to Excel how to bring ON TOP ?

Posted: Thu Jun 20, 2013 5:11 am
by ukoenig
Thank You very much for the response.

I tested the function and Excel moves to TOP.
It is still funny :
1. Excel opens on TOP
2. Excel moves to BACK
3. Excel moves to TOP again

@ 245, 240 BTNBMP oBtn2 OF oDlg ;
SIZE 50, 25 PIXEL;
NOBORDER ;
PROMPT "&Excel " ;
ACTION ( IIF( oFld:nOption = 1, oBrw1:ToExcel(), oBrw2:ToExcel() ), ; // ASC or VKEYS
SETFOCUSAFTER( FINDWINDOW( "XLMAIN", 0 ) ) ) ;
FILENAME c_path1 + "Excel.Bmp" ;
FONT oFont2 2007 ;
LEFT
oBtn2:lTransparent := .t.
oBtn2:cToolTip = { "Export " + CRLF + "to EXCEL","EXPORT", 1, CLR_BLACK, 14089979 }
oBtn2:SetColor( 0, )

Best Regards
Uwe :lol: