Set function key to a Value
Moderator: Rathinagiri
Re: Set function key to a Value
Thanks to all.
I am still having trouble.
I have a field in a table called F2 which holds a value of EG: '123' ( I class this as a macro)
I am using an inputbox to enter a part number to put on an invoice.
I am in Form_1.Grid_1
My program says p:= inputbox('Enter Item')
When I press Ctrl+F2 which is Function 22 (in clipper) I want table->f2 value typed in inputbox for me .
Then I seek 'p' in an other table .
My command in Clipper Program was Set Function 22 to Alltrim(Table->f2)
This was at very start of program so no matter where I was in program when I pushed Ctrl+F2 Table->F2 was enterd for me.
I have 9 of these macros
Table->F3 := Function 23 and so on.
I tried this with a text box in my program but would not work. Entry was blank.
ON KEY F2 OF Form_Grid_In2 ACTION SetProperty( 'FORM_GRID_IN2.Grid_2' , GetProperty( 'Form_Grid_In2.Grid_2' , 'FocusedControl' ) , 'Value' , '123' )
I hope I have explained this clearly.
Thanks again FRanco
I am still having trouble.
I have a field in a table called F2 which holds a value of EG: '123' ( I class this as a macro)
I am using an inputbox to enter a part number to put on an invoice.
I am in Form_1.Grid_1
My program says p:= inputbox('Enter Item')
When I press Ctrl+F2 which is Function 22 (in clipper) I want table->f2 value typed in inputbox for me .
Then I seek 'p' in an other table .
My command in Clipper Program was Set Function 22 to Alltrim(Table->f2)
This was at very start of program so no matter where I was in program when I pushed Ctrl+F2 Table->F2 was enterd for me.
I have 9 of these macros
Table->F3 := Function 23 and so on.
I tried this with a text box in my program but would not work. Entry was blank.
ON KEY F2 OF Form_Grid_In2 ACTION SetProperty( 'FORM_GRID_IN2.Grid_2' , GetProperty( 'Form_Grid_In2.Grid_2' , 'FocusedControl' ) , 'Value' , '123' )
I hope I have explained this clearly.
Thanks again FRanco
All The Best,
Franco
Canada
Franco
Canada
Re: Set function key to a Value
Maybe I could create 9 variables at start of program Main saying
use table
V2 := table->v2, V3:= table->V3 ..... and so on
use
Set Function 22 to V2 .......... I do not know how to code this.
Then later in program when I am in Inputbox if I press Ctrl+f2 V2 would be entered
Franco
use table
V2 := table->v2, V3:= table->V3 ..... and so on
use
Set Function 22 to V2 .......... I do not know how to code this.
Then later in program when I am in Inputbox if I press Ctrl+f2 V2 would be entered
Franco
All The Best,
Franco
Canada
Franco
Canada
Re: Set function key to a Value
Franco,
Can you post a PRG with a DBF so we can analyse the problem ?
Theo
Can you post a PRG with a DBF so we can analyse the problem ?
Theo
Re: Set function key to a Value
Theo, try this.
All works except inputbox. because it is not connected to win1. It is hmg function.
I want to press f1 on inputbox and it enters 123 for me.
Also what would command be for Set key ctrl+f2 to somefunction(var1)
clippers ctrl+f2 = Function 22, but will not work
#include <hmg.ch>
Function Main
public Var1 := '123', Var2 := 'ABC'
DEFINE WINDOW Win1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 400 ;
TITLE 'Test Input' ;
MAIN
ON KEY F2 OF WIN1 ACTION Somefunction(Var1)
ON KEY F3 OF WIN1 ACTION Somefunction(Var2)
ON KEY F4 OF WIN1 Action Inputbox('Enter Item')
* ON KEY F22 OF WIN1 ACTION Somefunction(Var1) //will not work
DEFINE TEXTBOX TEXT1
ROW 10
COL 10
WIDTH 150
HEIGHT 20
END TEXTBOX
END WINDOW
Win1.Center
ACTIVATE WINDOW Win1
Return
FUNCTION Somefunction
Parameters var
cFocusedControl := GetProperty( 'Win1' , 'FocusedControl' )
IF GetControlType( cFocusedControl , "Win1") == "EDIT" .Or. GetControlType( cFocusedControl ,;
"Win1") == "TEXT"
SetProperty( 'Win1' , cFocusedControl , 'Value' , var )
ENDIF
***** This will not work and is what I need *****
***** Inputbox is not part of Win1
*IF GetControlType == Inputbox
* SetProperty( 'Inputbox' , 'Value' , var )
*ENDIF
RETURN
All works except inputbox. because it is not connected to win1. It is hmg function.
I want to press f1 on inputbox and it enters 123 for me.
Also what would command be for Set key ctrl+f2 to somefunction(var1)
clippers ctrl+f2 = Function 22, but will not work
#include <hmg.ch>
Function Main
public Var1 := '123', Var2 := 'ABC'
DEFINE WINDOW Win1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 400 ;
TITLE 'Test Input' ;
MAIN
ON KEY F2 OF WIN1 ACTION Somefunction(Var1)
ON KEY F3 OF WIN1 ACTION Somefunction(Var2)
ON KEY F4 OF WIN1 Action Inputbox('Enter Item')
* ON KEY F22 OF WIN1 ACTION Somefunction(Var1) //will not work
DEFINE TEXTBOX TEXT1
ROW 10
COL 10
WIDTH 150
HEIGHT 20
END TEXTBOX
END WINDOW
Win1.Center
ACTIVATE WINDOW Win1
Return
FUNCTION Somefunction
Parameters var
cFocusedControl := GetProperty( 'Win1' , 'FocusedControl' )
IF GetControlType( cFocusedControl , "Win1") == "EDIT" .Or. GetControlType( cFocusedControl ,;
"Win1") == "TEXT"
SetProperty( 'Win1' , cFocusedControl , 'Value' , var )
ENDIF
***** This will not work and is what I need *****
***** Inputbox is not part of Win1
*IF GetControlType == Inputbox
* SetProperty( 'Inputbox' , 'Value' , var )
*ENDIF
RETURN
All The Best,
Franco
Canada
Franco
Canada
- Rathinagiri
- Posts: 5471
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: Set function key to a Value
Inputbox window name is '_InputBox'
Textbox/editbox inside inputbox is named as '_TextBox'
This you can use in your programme.
For various key combinations that can be used, please see i_keybd.ch in HMG include folder.
Textbox/editbox inside inputbox is named as '_TextBox'
This you can use in your programme.
For various key combinations that can be used, please see i_keybd.ch in HMG include folder.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: Set function key to a Value
Porque no creas tu propio Inputbox() ?
Por ejemplo...
*-------------------------------------------------
Why not create your own Inputbox() ?
For example...
O intenta con el ejemplo:
..\HMG\3.4.3\SAMPLES\Controls\Grid\GRID_10\demo.prg
Por ejemplo...
*-------------------------------------------------
Why not create your own Inputbox() ?
For example...
Code: Select all
#include <hmg.ch>
Function Main
public aCpos
* use table
aCpos := {"123", "456", "789" }
DEFINE WINDOW Win1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 400 ;
TITLE 'Test Input' MAIN
ON KEY F2 OF "Win1" ACTION ( MyInputBox( aCpos, "Win1" ) )
DEFINE TEXTBOX TEXT1
ROW 10
COL 10
WIDTH 150
HEIGHT 20
END TEXTBOX
END WINDOW
CENTER WINDOW Win1
ACTIVATE WINDOW Win1
Return
FUNCTION MyInputBox( aCpos, cForm )
cFocusedControl := ThisWindow.FocusedControl
IF GetControlType( cFocusedControl , cForm ) == "TEXT"
DEFINE WINDOW InpBox AT 0,0 WIDTH 200 HEIGHT 200 TITLE 'My InputBox()' CHILD
*------------ Other way ------------------------------------------------------------------------------------------
*SELE Table
*@ 020,000 COMBOBOX CB_Options OF &cForm. ITEMSOURCE F1, F2, F3 VALUE 1 WIDTH 50 HEIGHT 25 FONT "Verdana" SIZE 10
*-------------------------------------------------------------------------------------------------------------------
@ 020,010 COMBOBOX CB_Options OF InpBox ITEMS aCpos VALUE 1 WIDTH 150 HEIGHT 70 FONT "Verdana" SIZE 10 ;
ON CHANGE ( SetProperty( cForm, cFocusedControl , 'Value', InpBox.CB_Options.DisplayValue ), ThisWindow.Release )
END WINDOW
CENTER WINDOW InpBox
ACTIVATE WINDOW InpBox
ENDIF
RETURN
..\HMG\3.4.3\SAMPLES\Controls\Grid\GRID_10\demo.prg
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Set function key to a Value
As Rathi said:
Will do the trick...
Code: Select all
SetProperty( '_InputBox', '_TextBox', 'Value' ,'something...' )
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
- mustafa
- Posts: 1158
- Joined: Fri Mar 20, 2009 11:38 am
- DBs Used: DBF
- Location: Alicante - Spain
- Contact:
Re: Set function key to a Value
Hola Andres
Me he tomado la libertad de modificar un poco tu Sample
para que se parezca un poco más a un Inputbox()
Saludos
*------------------------------------------------------*
Hello Andres
I have taken the liberty to modify a little your Sample
to make it look a bit more to a Inputbox ()
regards
Mustafa
Me he tomado la libertad de modificar un poco tu Sample
para que se parezca un poco más a un Inputbox()
Saludos
*------------------------------------------------------*
Hello Andres
I have taken the liberty to modify a little your Sample
to make it look a bit more to a Inputbox ()
regards
Mustafa
Code: Select all
#include <hmg.ch>
Function Main
public aCpos
* use table
aCpos := {"123", "456", "789" }
DEFINE WINDOW Win1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 400 ;
TITLE 'Test Input -> KEY [F2]' MAIN
ON KEY F2 OF "Win1" ACTION ( MyInputBox( aCpos, "Win1" ) )
DEFINE TEXTBOX TEXT1
ROW 10
COL 10
WIDTH 150
HEIGHT 20
END TEXTBOX
END WINDOW
CENTER WINDOW Win1
ACTIVATE WINDOW Win1
Return
FUNCTION MyInputBox( aCpos, cForm )
cFocusedControl := ThisWindow.FocusedControl
IF GetControlType( cFocusedControl , cForm ) == "TEXT"
DEFINE WINDOW InpBox AT 0,0 WIDTH 300 HEIGHT 150 TITLE 'My InputBox()' NOSYSMENU NOMAXIMIZE NOMINIMIZE CHILD
*------------ Other way ------------------------------------------------------------------------------------------
*SELE Table
*@ 020,000 COMBOBOX CB_Options OF &cForm. ITEMSOURCE F1, F2, F3 VALUE 1 WIDTH 50 HEIGHT 25 FONT "Verdana" SIZE 10
*-------------------------------------------------------------------------------------------------------------------
@ 020,030 COMBOBOX CB_Options OF InpBox ITEMS aCpos VALUE 1 WIDTH 150 HEIGHT 70 FONT "Verdana" SIZE 10 //;
** ON CHANGE ( SetProperty( cForm, cFocusedControl , 'Value', InpBox.CB_Options.DisplayValue ), ThisWindow.Release )
*------------------------------ Botones --------------------------------------------------------------------*
@ 69,068 BUTTON CercaX ;
CAPTION 'Accept' ;
TOOLTIP 'Search by Date' ;
ACTION ( SetProperty( cForm, cFocusedControl , 'Value', InpBox.CB_Options.DisplayValue ), ThisWindow.Release )
*-------------------------------------------------------------------------------------------------------------*
@ 69,172 BUTTON SalidaX ;
CAPTION 'Cancel' ;
TOOLTIP 'Cancel ...' ;
ACTION InpBox.Release
END WINDOW
CENTER WINDOW InpBox
ACTIVATE WINDOW InpBox
ENDIF
RETURN
Re: Set function key to a Value
Perfecto Mustafa
Es la idea de que estemos en el Foro: compartir, participar, aportar, adaptar, mejorar y volver a compartir.
(y porque no, en su caso, alguna critica constructiva).
Cada duda y respuesta, da pie a nuevas ideas que podemos adaptar a nuestras necesidades y aprender uno del otro.
*---------------------------------------------------------------------------------------------------------------------------------------
Perfect Mustafa
It is the idea that we are in Forum: share, participate, contribute, adapt, improve and share back.
(And why not, if necessary, any constructive criticism).
Each question and answer, gives rise to new ideas that can adapt to our needs and learn from each other.
Es la idea de que estemos en el Foro: compartir, participar, aportar, adaptar, mejorar y volver a compartir.
(y porque no, en su caso, alguna critica constructiva).
Cada duda y respuesta, da pie a nuevas ideas que podemos adaptar a nuestras necesidades y aprender uno del otro.
*---------------------------------------------------------------------------------------------------------------------------------------
Perfect Mustafa
It is the idea that we are in Forum: share, participate, contribute, adapt, improve and share back.
(And why not, if necessary, any constructive criticism).
Each question and answer, gives rise to new ideas that can adapt to our needs and learn from each other.
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: Set function key to a Value
I want to thank all for your responses. I have learned so much from this problem.
I like the idea of creating my own inputbox and putting it in my procedure file.
This way I can change function key for different windows .
I am still working on Rathinagiri and Roberto's response but have not quite figured it out yet.
Thanks again ......... Franco
I like the idea of creating my own inputbox and putting it in my procedure file.
This way I can change function key for different windows .
I am still working on Rathinagiri and Roberto's response but have not quite figured it out yet.
Thanks again ......... Franco
All The Best,
Franco
Canada
Franco
Canada