Set function key to a Value
Moderator: Rathinagiri
Re: Set function key to a Value
Still having problems. Can not get ctrl+f2 to work.
In clipper language ctrl+f2 = F22.
Is there such a thing as ON KEY Ctrl+f2 OF Form_1 ACTION Somefunction().
I tried (#define VK_F22 133) from include folder but does not work. I do not know what 133 is or the value of ctrl+F2.
I have everything worked out if I can Get ctrl+F2 to..... ctrl+F10 to work. Very simple
ON KEY F22 OF FORM_1 ACTION MSGBOX('123').
And is there a global way at start of main program so F22 is set through complete program.
Franco.
In clipper language ctrl+f2 = F22.
Is there such a thing as ON KEY Ctrl+f2 OF Form_1 ACTION Somefunction().
I tried (#define VK_F22 133) from include folder but does not work. I do not know what 133 is or the value of ctrl+F2.
I have everything worked out if I can Get ctrl+F2 to..... ctrl+F10 to work. Very simple
ON KEY F22 OF FORM_1 ACTION MSGBOX('123').
And is there a global way at start of main program so F22 is set through complete program.
Franco.
All The Best,
Franco
Canada
Franco
Canada
Re: Set function key to a Value
Franco,
Try:
ON KEY CONTROL+F2 OF Form_1 ACTION ( Somefunction() )
But it is not a good idea to combine CONTROL+F2 with the _Pushkey function like _Pushkey(VK_1) (elseway CTRL-1 is pressed if you do not release the CTRL key quick enough).
But you can use it in combination with the solution Roberto described.
Try:
ON KEY CONTROL+F2 OF Form_1 ACTION ( Somefunction() )
But it is not a good idea to combine CONTROL+F2 with the _Pushkey function like _Pushkey(VK_1) (elseway CTRL-1 is pressed if you do not release the CTRL key quick enough).
But you can use it in combination with the solution Roberto described.
Re: Set function key to a Value
Have it figured but still only works in a single window. Takes a lot of program lines to put it in all windows.
If I could figure how to make it globel through whole program it would be great.
here is how it works.
=====================================================================
Procedure Main
use file1 // File1 is table with macros in it. Field2 := '123'
define window win1
ON KEY CONTROL+F2 OF Win1 ACTION ( Somefunction(File1->Field2) )
Close file1
Return
Procedure somefunction
public a
parameters mf1
a:= Inputbox('Enter Item', 'Enter Item', mf1)
(Do Something With a)
return
======================================================================
Now I can do what I want with variable a .
I would like to set it in MAIN procedure (First Procedure) so it works throughout program.
Franco
If I could figure how to make it globel through whole program it would be great.
here is how it works.
=====================================================================
Procedure Main
use file1 // File1 is table with macros in it. Field2 := '123'
define window win1
ON KEY CONTROL+F2 OF Win1 ACTION ( Somefunction(File1->Field2) )
Close file1
Return
Procedure somefunction
public a
parameters mf1
a:= Inputbox('Enter Item', 'Enter Item', mf1)
(Do Something With a)
return
======================================================================
Now I can do what I want with variable a .
I would like to set it in MAIN procedure (First Procedure) so it works throughout program.
Franco
All The Best,
Franco
Canada
Franco
Canada
Re: Set function key to a Value
The only way, I think, is to modify sources\h_textbox.prg to be sensitive on function keys.franco wrote:Have it figured but still only works in a single window. Takes a lot of program lines to put it in all windows.
If I could figure how to make it globel through whole program it would be great.
here is how it works.
=====================================================================
Procedure Main
use file1 // File1 is table with macros in it. Field2 := '123'
define window win1
ON KEY CONTROL+F2 OF Win1 ACTION ( Somefunction(File1->Field2) )
Close file1
Return
Procedure somefunction
public a
parameters mf1
a:= Inputbox('Enter Item', 'Enter Item', mf1)
(Do Something With a)
return
======================================================================
Now I can do what I want with variable a .
I would like to set it in MAIN procedure (First Procedure) so it works throughout program.
Franco
But, this solution is dirty...
Re: Set function key to a Value
Have you tried making it a function, called (with just one line of code) from within any window where it's needed?Have it figured but still only works in a single window. Takes a lot of program lines to put it in all windows.
If I could figure how to make it globel through whole program it would be great.
Re: Set function key to a Value
This is my next thought.
send window parameter and function parameter to a seperate procedure . I will try and let you know.
thanks Franco
send window parameter and function parameter to a seperate procedure . I will try and let you know.
thanks Franco
All The Best,
Franco
Canada
Franco
Canada
Re: Set function key to a Value
No entiendo aquí.. Si el parámetro, mf1 es igual a "123" y lo estas asignando a la variable "a",
para que necesitas la funcion Inputbox() ?
------------------------------------------------------------------------------------------------------------------
I do not understand here .. If, mf1 parameter is equal to "123" and those assigned to the variable "a",
why you need the Inputbox() function ?
para que necesitas la funcion Inputbox() ?
------------------------------------------------------------------------------------------------------------------
I do not understand here .. If, mf1 parameter is equal to "123" and those assigned to the variable "a",
why you need the Inputbox() function ?
Code: Select all
Procedure somefunction
public a
parameters mf1
// a:= Inputbox('Enter Item', 'Enter Item', mf1)
// (Do Something With a)
Do Something With mf1 // <=================
return
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: Set function key to a Value
Tal vez esto... (en teoría)
-----------------------
Maybe this... (in theory)
-----------------------
Maybe this... (in theory)
Code: Select all
Procedure Main
Public CodBlck_1, CodBlck_2, CodBlck_3, CodBlck_x
use file1
CodBlck_1 := { || Somefunction( Field2 ) }
CodBlck_2 := { || Somefunction( Field3 ) }
CodBlck_3 := { || Somefunction( Field4 ) }
CodBlck_x := { || Somefunction( Fieldx ) }
Close file1
define window win1
ON KEY CONTROL+F2 OF Win1 ACTION ( CodBlck_1 )
//.........
end window
Return
Procedure Win2
define window win2
ON KEY CONTROL+Fx OF Win2 ACTION ( CodBlck_2 )
//.........
end window
Return
Procedure Win3
define window win3
ON KEY CONTROL+Fx OF Win3 ACTION ( CodBlck_3 )
//.........
end window
Return
Procedure somefunction
parameters mf1
Do Something With mf1
return
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: Set function key to a Value
Hi!franco wrote:Have it figured but still only works in a single window. Takes a lot of program lines to put it in all windows.
If I could figure how to make it globel through whole program it would be great.
here is how it works.
=====================================================================
Procedure Main
use file1 // File1 is table with macros in it. Field2 := '123'
define window win1
ON KEY CONTROL+F2 OF Win1 ACTION ( Somefunction(File1->Field2) )
Close file1
Return
Procedure somefunction
public a
parameters mf1
a:= Inputbox('Enter Item', 'Enter Item', mf1)
(Do Something With a)
return
======================================================================
Now I can do what I want with variable a .
I would like to set it in MAIN procedure (First Procedure) so it works throughout program.
Franco
You can define one function, eg:
Code: Select all
function SetupFunctionKeys
param cFormName
ON KEY CONTROL+F1 OF &cFormName ACTION ( Somefunction(File1->Field1) )
ON KEY CONTROL+F2 OF &cFormName ACTION ( Somefunction(File1->Field2) )
.
.
.
return .t.
It should be easy and quick to do, even if you have a lot of defined forms.
Re: Set function key to a Value
I wrote
Procedure Main
use file1 // File1 is table with macros in it. Field2 := '123'
define window win1
ON KEY CONTROL+F2 OF Win1 ACTION ( Somefunction(File1->Field2) )
Close file1
Return
Procedure somefunction
public a
parameters mf1
a:= Inputbox('Enter Item', 'Enter Item', mf1)
(Do Something With a)
what I do with a in this situation is Mf1 it entered in the inputbox for me
if Mf1 is (" " = nothing) I need to enter they entry manually .
use table2
seek a and so on.
The only thing is now I would also like to use Mf1 in a textbox of the window.
** This is where Roberto`s code could work.
** Something like
if Win1 is focused
Roberto`s code
else
inputbox has focus
do Franco code
endif
How can I check which window has focus
return
Really what I need is really simple and we may have got of track.
my control+F2 is a word
at start of main program
instead of on key which does action I need Set KEY which types a word
Set Key Control+F2 to '123' then when I press ctrl+F2 program enters '123' for me. Macro
Like F1 is set to help no matter where you are
Thanks Franco
Procedure Main
use file1 // File1 is table with macros in it. Field2 := '123'
define window win1
ON KEY CONTROL+F2 OF Win1 ACTION ( Somefunction(File1->Field2) )
Close file1
Return
Procedure somefunction
public a
parameters mf1
a:= Inputbox('Enter Item', 'Enter Item', mf1)
(Do Something With a)
what I do with a in this situation is Mf1 it entered in the inputbox for me
if Mf1 is (" " = nothing) I need to enter they entry manually .
use table2
seek a and so on.
The only thing is now I would also like to use Mf1 in a textbox of the window.
** This is where Roberto`s code could work.
** Something like
if Win1 is focused
Roberto`s code
else
inputbox has focus
do Franco code
endif
How can I check which window has focus
return
Really what I need is really simple and we may have got of track.
my control+F2 is a word
at start of main program
instead of on key which does action I need Set KEY which types a word
Set Key Control+F2 to '123' then when I press ctrl+F2 program enters '123' for me. Macro
Like F1 is set to help no matter where you are
Thanks Franco
All The Best,
Franco
Canada
Franco
Canada