Set function key to a Value

Moderator: Rathinagiri

User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Set function key to a Value

Post 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
Andrés González López
Desde Guadalajara, Jalisco. México.
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Set function key to a Value

Post 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
Last edited by franco on Sat Jul 30, 2016 5:54 pm, edited 1 time in total.
All The Best,
Franco
Canada
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Set function key to a Value

Post 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
There's nothing you can do that can't be done...
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Set function key to a Value

Post 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' )
There's nothing you can do that can't be done...
franco
Posts: 816
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: Set function key to a Value

Post by franco »

Serge,
Fixed ....Thanks for note.
Franco
All The Best,
Franco
Canada
Post Reply