FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour xBrowse to Excel how to bring ON TOP ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
xBrowse to Excel how to bring ON TOP ?
Posted: Wed Jun 05, 2013 12:59 PM
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.



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 :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: xBrowse Excel only shown iconized ?
Posted: Wed Jun 05, 2013 01:26 PM

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.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: xBrowse Excel only shown iconized ?
Posted: Wed Jun 05, 2013 01:46 PM
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 :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: xBrowse to Excel is only shown iconized ?
Posted: Thu Jun 06, 2013 09:52 AM
Jeff,

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

Tested with sample :



Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: xBrowse to Excel is only shown iconized ?
Posted: Thu Jun 06, 2013 12:08 PM

Uwe

Try

oExcel:Visible := .T.

without all the rest , it should be enough

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: xBrowse to Excel how to bring ON TOP ?
Posted: Thu Jun 06, 2013 01:32 PM
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 :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 244
Joined: Fri Oct 28, 2005 06:29 PM
Re: xBrowse to Excel how to bring ON TOP ?
Posted: Wed Jun 19, 2013 02:41 PM

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

Alejandro Cebolido

Buenos Aires, Argentina
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: xBrowse to Excel how to bring ON TOP ?
Posted: Thu Jun 20, 2013 02:18 AM
I use this
Code (fw): Select all Collapse
  .
  .
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
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: xBrowse to Excel how to bring ON TOP ?
Posted: Thu Jun 20, 2013 05:11 AM
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 :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion