Topic: simulate a tab key
Hello MVD funs
please how can i create a button to simulate a tab key or a tab+shift key.
I want to move selection from one editbox to an other by that button.
Thabk you.
My Visual Database → Script → simulate a tab key
Hello MVD funs
please how can i create a button to simulate a tab key or a tab+shift key.
I want to move selection from one editbox to an other by that button.
Thabk you.
Hello.
You can set focus to the next component, using this code:
Form1.SetFocusNextControl;
but you can't use this method by click on button, because when you click on a button, you set focus on this button.
Thank you.
but i mean how to send a key to the form or a combinition of keys. like "keybd-event" or "sendkey()".
i dont want to use pc keybord in my application.
There is no function to send a key to the form.
Why you don't want to use SetFocusNextControl method?
thank you for response.
first you say that i coud not use it with a button.
second i want to simulate a numpad keys in my form. to input numbers to multiple fields.
i m using a tablet. so i dont want to use the embaded virtual keybord to save space.
hichame
Maybe the attached will help you.
Hi EHW,
I had a look at this problem but was going for the no-script option as always (only joking!).
It's a neat solution - nice one.
Derek.
hello
thank you ehwagner for this solution. I will try to use it . But it would be more easy if there was a function to simulate a key in one button . Especially whene there is a large number of fields in the form.
hello
thank you ehwagner for this solution. I will try to use it . But it would be more easy if there was a function to simulate a key in one button . Especially whene there is a large number of fields in the form.
Example:
procedure SendKeyForAllEdits(Form: TAForm; sKey: string);
var
i,c: integer;
begin
c := Form.ComponentCount-1;
for i := 0 to c do
begin
if Form.Components[i] is TdbEdit then TdbEdit(Form.Components[i]).Text := TdbEdit(Form.Components[i]).Text + sKey;
end;
end;
procedure Form1_Button3_OnClick (Sender: string; var Cancel: boolean);
begin
SendKeyForAllEdits(Form1, '1'); // how to use
end;
thank you for your example.
My Visual Database → Script → simulate a tab key
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi