>Hi all,
>
>I like to implement a function to the ALT-P key to activate the PROPER() function on the current active TextBox on the form.
>
>I already tried:
>
>ON KEY LABEL ALT+P MyProper(ThisForm.Activecontrol.Value)
>
>FUNCTION(tcValue)
>
>Proper(tcValue)
>
>RETURN(.T.)
>
>It dit not work because the 'ThisForm.' does only works on the form itselve.
>
>Wat is an other way to make this work ??
>
>Thanks in advance,
>
>Theo
Theo,
Assuming your function is just a skeleton and typo, you could use :
_screen.activeform.activecontrol.value
However I think what you really want to pass the object itself :
_screen.activeform.activecontrol
Or better pass nothing and function can check itself :
ON KEY LABEL ALT+P do MyProper()
function myProper
with _screen
if type('.activeform.activecontrol')='O' ;
and type('.activeform.activecontrol.value') = 'C'
with _screen.activeform.activecontrol
.value = proper(.value)
endwith
endif
But remember you could do this in textbox class (by adding GetKeyState API call). An easier way would be a command button with alt+p shortcut or menu option. On key label is almost obsolete.
Cetin