Informe de la aplicacion

HMG en Español

Moderator: Rathinagiri

Post Reply
Agustin
Posts: 79
Joined: Sat Feb 16, 2013 10:50 pm
Location: Miranda de Ebro / España

Informe de la aplicacion

Post by Agustin »

Hay alguna forma de que desde cualquier parte del programa se pueda llamar a una función que nos de informe de tablas abiertas, indices etc..
Poniendo ON KEY en cada Form funciona, pero me gustaría tener una única llamada.
Saludos cordiales
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Informe de la aplicacion

Post by srvet_claudio »

See this demo:

Code: Select all

#include "hmg.ch"

Function Main

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 500 HEIGHT 300 ;
      TITLE "Press ALT+F9";
      MAIN

      @ 30,10 EDITBOX Edit_1 ;
         WIDTH 400 ;
         HEIGHT 100 ;
         VALUE 'Hello' 

      @ 200, 100 BUTTON Button_1 CAPTION "Modal" ACTION ModalWin()
   END WINDOW

   DEFINE WINDOW Form_Info;
      AT 0,0;  
      WIDTH 700;  
      HEIGHT 600;
      FONTNAME "Courier New" FONTSIZE 10;
      NOAUTORELEASE
      @ 10 , 10 LABEL Label_1 VALUE "Display your Info" AUTOSIZE
      @ 30 , 10 LABEL Label_2 VALUE "" AUTOSIZE
   END WINDOW

   CREATE EVENT PROCNAME FormInfoKeyProc()

   CENTER WINDOW Form_1
   ACTIVATE WINDOW Form_1
Return Nil


Function FormInfoKeyProc()
   IF HMG_VirtualKeyIsPressed (VK_F9) .AND. HMG_VirtualKeyIsPressed (VK_ALT)
      Form_Info.SHOW
   ENDIF
   IF ISWINDOWENABLED (Form_Info.HANDLE) == .F.
      ENABLEWINDOW (Form_Info.HANDLE)   // avoid disable Form_Info for Modal Windows
   ENDIF
   Form_Info.Label_2.VALUE := "Modal Window : " + IF (_IsWindowDefined ( "Form_2" ) == .F., "OFF","ON")
Return NIL


Procedure ModalWin
   IF _IsWindowDefined ( "Form_2" ) == .F.
      DEFINE WINDOW Form_2;  
          AT 0,0;  
          WIDTH 200;  
          HEIGHT 200;
          MODAL

          @ 10 , 10 LABEL Label_1 VALUE "Modal Window" AUTOSIZE
      END WINDOW
      CENTER WINDOW Form_2
      ACTIVATE WINDOW Form_2
   ENDIF
Return
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Informe de la aplicacion

Post by Javier Tovar »

Gracias Dr. Claudio Soto por compartir, y un excelente demo! :D :D :D

Saludos
Agustin
Posts: 79
Joined: Sat Feb 16, 2013 10:50 pm
Location: Miranda de Ebro / España

Re: Informe de la aplicacion

Post by Agustin »

Muchisimas gracias por su ayuda.
User avatar
mol
Posts: 3774
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Informe de la aplicacion

Post by mol »

I want to modify FormInfoKeyProc() for replacing pressed comma to dot "on the fly".
I don't know, why comma does not appear in the editbox:

Code: Select all


Function FormInfoKeyProc()
   IF xtemp := HMG_VirtualKeyIsPressed (VK_DECIMAL)	// kropka
		msgdebug("Decimal on the numeric keyboard was pressed!")
		HMG_SendCharacter (Form_1.Handle , "," )
		return 1
	endif
	
   IF HMG_VirtualKeyIsPressed (VK_F9) .AND. HMG_VirtualKeyIsPressed (VK_ALT)
      Form_Info.SHOW
   ENDIF
   IF ISWINDOWENABLED (Form_Info.HANDLE) == .F.
      ENABLEWINDOW (Form_Info.HANDLE)   // avoid disable Form_Info for Modal Windows
   ENDIF
   Form_Info.Label_2.VALUE := "Modal Window : " + IF (_IsWindowDefined ( "Form_2" ) == .F., "OFF","ON")
Return NIL
User avatar
srvet_claudio
Posts: 2220
Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:

Re: Informe de la aplicacion

Post by srvet_claudio »

mol wrote:I want to modify FormInfoKeyProc() for replacing pressed comma to dot "on the fly".
I don't know, why comma does not appear in the editbox:

Code: Select all


Function FormInfoKeyProc()
   IF xtemp := HMG_VirtualKeyIsPressed (VK_DECIMAL)	// kropka
		msgdebug("Decimal on the numeric keyboard was pressed!")
		HMG_SendCharacter (Form_1.Handle , "," )
		return 1
	endif
	
   IF HMG_VirtualKeyIsPressed (VK_F9) .AND. HMG_VirtualKeyIsPressed (VK_ALT)
      Form_Info.SHOW
   ENDIF
   IF ISWINDOWENABLED (Form_Info.HANDLE) == .F.
      ENABLEWINDOW (Form_Info.HANDLE)   // avoid disable Form_Info for Modal Windows
   ENDIF
   Form_Info.Label_2.VALUE := "Modal Window : " + IF (_IsWindowDefined ( "Form_2" ) == .F., "OFF","ON")
Return NIL
Hi Marek,
see this code:

Code: Select all

Function FormInfoKeyProc()

   IF HMG_GetLastVirtualKeyDown() == VK_DECIMAL
       HMG_CleanLastVirtualKeyDown()  // avoid re-entry
//      msgdebug("Decimal on the numeric keyboard was pressed!")
      HMG_SendCharacter (Form_1.Edit_1.Handle , "," )
      return 1
   endif

   IF HMG_VirtualKeyIsPressed (VK_F9) .AND. HMG_VirtualKeyIsPressed (VK_ALT)
      Form_Info.SHOW
   ENDIF
   IF ISWINDOWENABLED (Form_Info.HANDLE) == .F.
      ENABLEWINDOW (Form_Info.HANDLE)   // avoid disable Form_Info for Modal Windows
   ENDIF
   Form_Info.Label_2.VALUE := "Modal Window : " + IF (_IsWindowDefined ( "Form_2" ) == .F., "OFF","ON")
Return NIL
Best regards.
Dr. Claudio Soto
(from Uruguay)
http://srvet.blogspot.com
Post Reply