Doubt of pure unknowless ... / Duda de puro ignorante ...

HMG en Español

Moderator: Rathinagiri

User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by gcarrizo »

How explain about it ...
I have a toolbar and there open it a modal window with two buttons .
one of them export and them open in excel... but that sheet excel's app go to background.
Of course if that button be put in toolbar and i execute it excel appears on top.
They Have a way to do the same from a modal window and once i execute it excel is show in top ?
Attached printscreen

Regards
-------------------------------------------------------------------------------------------------------------------
Cómo explicarlo ...
Tengo una barra de herramientas y allí se abre una ventana modal con dos botones.
Uno de ellos exporta y se abre en Excel ... pero al abrir la hoja de Excel la aplicación va al fondo pasa a segundo plano.
Por supuesto si ese botón se pone en la barra de herramientas y lo ejecuto excel aparece en primer plano.
Tienen una manera de hacer lo mismo desde una ventana modal y una vez que lo ejecute excel se muestra en la primer plano ?
Adjunto Caputra de Pantalla .

Saludos
Attachments
test001.jpg
test001.jpg (101.91 KiB) Viewed 5060 times
test002.jpg
test002.jpg (106.28 KiB) Viewed 5060 times
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by EduardoLuis »

Hola GCarrizo:

Probá con cerrar la ventana modal luego de iniciar Excel.-
P. ej.
DEF.....BUTTON
ON ACTION ( ejecutar() , VENTANAMODAL.RELEASE )

PROCEDURE EJECUTAR
EXECUTE FILE "HOJA_EXCEL.XLS"
RETURN

Espero que con ello resuelvas tu problema.
Cordialmente
Eduardo

Hi GCarrizo:

Try closing modal window after initiate Excel
F. Ex.

DEF....... BUTTON
ON ACTION ( ejecutar() , VENTANAMODAL.RELEASE )

PROCEDURE EJECUTAR
EXECUTE FILE "HOJA_EXCEL.XLS"
RETURN

Hopping this solve's your issue.-
With Regards
Eduardo
User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by gcarrizo »

Thanks for you support.

I try with that but result now is excel in back like focus and toolbar on top ... you see attached printscreen.

Regards
-----------------------------------------------------------------------------------------------------------------------
Gracias por su apoyo.

Intento con eso pero el resultado ahora es excel en como fondo ( el foco en excel ) y la barra de herramientas en el frente ... tal cual se ve en la captura de pantalla adjunta.

Saludos
-----------------------------------------------------------------------------------------------------------------------
Attachments
test003.jpg
test003.jpg (76.73 KiB) Viewed 5031 times
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by EduardoLuis »

Hola Gcarrizo:

Hice un test y si la ventana modal es cerrada, como vos decís pasa el control de foco a la ventana principal y queda EXCEL en 2do. plano.-
Hice otro test sin cerrar la ventana modal, y el foco lo tiene la ventana EXCEL (la que tengo maximizada por defecto), y al cerrarla debo cerrar la venta modal de Hmg para que luego pase el control a la ventana principal de HMG.-
Voy a continuar haciendo otros test y mañana te comento.-
Abrazo
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by Rathinagiri »

http://www.hmgforum.com/viewtopic.php?p=39513#p39513

The above post may help you. It gave an example of getting all the applications running with a particular title. You can get the handle with Excel and make that window focus.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by gcarrizo »

Gracias nuevamente !!! :geek: ( thanks again !!! )
---------------------------------------------------------------
EduardoLuis wrote: Wed Aug 16, 2017 10:14 pm
Voy a continuar haciendo otros test y mañana te comento.-
Abrazo
User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by gcarrizo »

8-)


Analyzing and Testing ...
Thank you for your collaboration.
Regards
---------------------------------------------
Analizando y Probando ...
Gracias por tu colaboracion.
Saludos

--------------------------------------------------------------------------------------------------------


Rathinagiri wrote: Thu Aug 17, 2017 4:11 am http://www.hmgforum.com/viewtopic.php?p=39513#p39513

... You can get the handle with Excel and make that window focus.
User avatar
gcarrizo
Posts: 43
Joined: Fri Oct 07, 2016 1:20 pm
DBs Used: DBF
Location: Argentina

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by gcarrizo »

At last I did was the follow
A) In the main add a function to minimize the app toolbar.
B) In the modal when executing excel in advance, indicate that it did
1st Close Modal
2nd Minimize the toolbar [Main]
3rd Export to Excel

I tried to explain it in the source code, so there is another way... if it is so nice to know. ;)

Best Regards.

-------------------------------------------------------------------------------------------------------------------
Al final lo que hice fue lo siguiente
a) En el principal agregue una funcion para minimizar la toolbar.
b) En la modal al ejecutar excel previamente indique que hiciera lo siguiente:
1º Cierre modal
2º Minimize la toolbar
3º Exporte

Traté de explicarlo en el codigo fuente , por ahi existe otro modo... si es asi seria bueno saberlo.

Saludos .

Code: Select all

Function Exp_2_XLS()

 /* CLOSE THIS MODAL WINDOWS  */
 /* CIERRA ESTA VENTANA MODAL */

Thiswindow.release

/* FUNCTION ON MAIN WITH JUST A SINGLE LINE -> Thiswindow.Minimize  (MINIMIZE TOOLBAR [MAIN])   */
/* FUNCION EN MAIN CON UNA SOLA LINEA       -> Thiswindow.Minimize  (MINIMIZA LA TOOLBAR [MAIN])*/

SET_FOCUS_BY_ MINIMIZE_MAIN()


/* EXPORT & OPEN EXCEL */
/* EXPORTADO Y APERTURA DEL ARCHIVO EN EXCEL */

use DAUX.dbf
COPY TO ('File_Archivo.XLS')
DBCLOSEALL()

Execute File 'excel.exe' PARAMETERS 'File_Archivo.XLS'

Return

User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by bpd2000 »

Due to some of incomplete details in your code
Replace Execute line with following function, it may help you
Excel CreateObject has in built Property to get the handle

Code: Select all


FUNCTION OnepExcelandGetHandle()
   LOCAL oExcel, oSheet
   oExcel := CreateObject( "Excel.Application" )
   oExcel:Visible := .F.
  
   hWnd:=oExcel:hWnd

   oSheet := oExcel:Workbooks:Open("c:\Your_FilePath\Book1.xlsx")
   
   oExcel:Visible := .T.
   RETURN hWnd

Code: Select all

#include "hmg.ch"

FUNCTION Main()
Public hwnd

   DEFINE WINDOW Form_1   ;
      AT 90,90            ;
      WIDTH 500           ;
      HEIGHT 300          ;
      TITLE "Demo"        ;
      MAIN
      ON KEY ESCAPE ACTION THISWINDOW.RELEASE
  
   END WINDOW

   @ 50, 50 BUTTON button       ;
      PARENT Form_1             ;
      CAPTION "Excel_Open"      ;
      WIDTH 100                 ;
      HEIGHT 50                 ;
      ONCLICK OnepExcelandGetHandle()
      
  @ 50, 200 BUTTON button2      ;
      PARENT Form_1             ;
      CAPTION "hWnd of Excel"   ;
      WIDTH 100                 ;
      HEIGHT 50                 ;
      ONCLICK MSGINFO(hWnd, "Handle of Excel" + SPACE(10))       
      
   @ 150, 50 BUTTON button3     ;
      PARENT Form_1             ;
      CAPTION "BringToTop"      ;
      WIDTH 100                 ;
      HEIGHT 50                 ;
      ONCLICK BringWindowToTop(hWnd) 

   @ 150, 200 BUTTON button4    ;
      PARENT Form_1             ;
      CAPTION "Show Excel"      ;
      WIDTH 100                 ;
      HEIGHT 50                 ;
      ONCLICK SHOWWINDOW(hWnd) 
   @ 150, 350 BUTTON button5    ;
      PARENT Form_1             ;
      CAPTION "Hide Excel"           ;
      WIDTH 100                 ;
      HEIGHT 50                 ;
      ONCLICK HIDEWINDOW(hWnd) 


   Form_1.Activate

   RETURN NIL


FUNCTION OnepExcelandGetHandle()
   LOCAL oExcel, oSheet
   oExcel := CreateObject( "Excel.Application" )
   oExcel:Visible := .F.
  
   hWnd:=oExcel:hWnd

   oSheet := oExcel:Workbooks:Open("c:\Your_FilePath\Book1.xlsx")
      
   oExcel:Visible := .T.
   RETURN hWnd
BPD
Convert Dream into Reality through HMG
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Doubt of pure unknowless ... / Duda de puro ignorante ...

Post by Rathinagiri »

Super!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply