Page 4 of 4

Re: Set function key to a Value

Posted: Thu Jul 28, 2016 1:58 am
by andyglezl
Hola Franco

Con Harbour (modo consola) puedes seguir haciendo lo que hacías con Clipper.
Pero si quieres hacerlo con HMG (modo grafico), necesitas "pensar" de modo diferente.

Si quieres seguir con HMG, deberas compilar y probar los múltiples ejemplos que tiene
la carpeta SAMPLES para que vayas entendiendo su manejo.

No se si ya viste este magnifico tutorial de Giovanni Di Maria, te será de mucha utilidad.
Se encuentra en: \HMG\3.4\DOC\data\index.htm
---------------------------------------------------------------------------------------------------------------------------
Hello Franco

With Harbour (console mode) you can keep doing what you did with Clipper.
But if you want to do with HMG (graphic mode), you need to "think" differently.

If you want to continue with HMG, you will have to compile and test the many examples that have
the SAMPLES folder for you to go understanding management.

I do not know if you saw this magnificent tutorial "Giovanni Di Maria" will be very useful.
It is located at: \HMG\3.4\DOC\data\index.htm

Re: Set function key to a Value

Posted: Fri Jul 29, 2016 6:36 pm
by franco
Hello to all.
Finally I have come up with what I need From all your help.
I have gotten some knowledge from every post. Thank You All.
Here is what I have come up with

Code: Select all

#include <hmg.ch>

Function Main
   public CtrlF2 := 'My Macro 1', CtrlF3 := 'My Macro 2'
   private a := ''
	
   DEFINE WINDOW Win1 ;
      AT 0,0 ;
      WIDTH 800 ;
      HEIGHT 400 ;
      TITLE 'Test Input' MAIN
	
	
	DEFINE LABEL LAB1
         ROW 20
         COL 200
         WIDTH 280
         HEIGHT 20
		 VALUE 'Enter Text   Or (  (Macro sets)  Or ( F4)  For Inputbox)  '  
	END LABEL
	
	DEFINE TEXTBOX TEXT1
      ROW 10
      COL 10
      WIDTH 150
      HEIGHT 20
	  ON ENTER  { || {Win1.Text2.Setfocus }}
   END TEXTBOX
   
   DEFINE TEXTBOX TEXT2
      ROW 35
      COL 10
      WIDTH 150
      HEIGHT 20
	   ON ENTER  { || {Win1.Text1.Setfocus }}
   END TEXTBOX
   
	SetKeys('Win1')  //sets all macros
	
	On Key F4 of Win1 Action { || {myInputbox()} , {msgbox('Now I Can Do Something With  '+a)}} 
  
    END WINDOW
   CENTER WINDOW Win1 
   ACTIVATE WINDOW Win1 
  
Return

Function MyInputBox
   
	DEFINE WINDOW MyBox ;
		AT win1.height/2,win1.width/2 ;
		WIDTH 300 ;
		HEIGHT 100 ;
		NOMAXIMIZE ;
		NOMINIMIZE ;
		NOSIZE;
		TITLE 'Input Window' CHILD

	DEFINE LABEL LAB1
         ROW 10
         COL 10
         WIDTH 280
         HEIGHT 20
		 VALUE 'Enter Text    (Escape/Blank to Exit)'
	END LABEL
	
	DEFINE TEXTBOX TEXT1
         ROW 30
         COL 10
         WIDTH 280
         HEIGHT 30
		 ON ENTER  { || {a := MyBox.Text1.Value} , {MyBox.Release} }	
	END TEXTBOX
	
		SetKeys('MYBOX') // Sets all macros
		
		ON KEY ESCAPE OF MyBox Action MyBox.Release

	END WINDOW

	MyBox.Text1.Setfocus
	CENTER WINDOW Mybox 
	ACTIVATE WINDOW Mybox 
Return

Function SetKeys(Fun)   
						// sets all macros

	ON KEY CONTROL+F2 OF Fun ACTION SetProperty( Fun , GetProperty( Fun , ;
		'FocusedControl' ) , 'Value' , CtrlF2 )
	ON KEY CONTROL+F3 OF Fun ACTION SetProperty( Fun , GetProperty( Fun , ;
		'FocusedControl' ) , 'Value' , CtrlF3 )
	* And so on More Macros
		
Return
Any additional thoughts ? .... Franco

Re: Set function key to a Value

Posted: Sat Jul 30, 2016 11:18 am
by serge_girard
Franco,

It works perfect. Although I cannot think of any use at this moment, I'm sure it will someday (now that we have it!).

Thanks, Serge

Re: Set function key to a Value

Posted: Sat Jul 30, 2016 11:21 am
by serge_girard
Franco,

By the way: there is this last ')' giving a compile error: VALUE 'Enter Text Or ( (Macro sets) Or ( F4) For Inputbox' )

Re: Set function key to a Value

Posted: Sat Jul 30, 2016 5:56 pm
by franco
Serge,
Fixed ....Thanks for note.
Franco