1. Keystrokes simulations
- Posted by Sergio Gelli <sergelli at uol.com.br> Jul 03, 2006
- 631 views
Bom dia para todos. Good morning for all I use with success the below code line: ii=invokeHandler(PushButton34, w32HClick, {}) But the next line don't work: ii = invokeHandler(PushButton34, VK_TAB, {}) The target is simulates the TAB key to change the focus to another objects inside an windows. I also was try : ii = invokeHandler(WinMain1, VK_TAB, {}) But, this don't work too. How can I simulates a keystrok into a progran ? Many thanks. Sérgio Gelii - Brasil
2. Re: Keystrokes simulations
- Posted by don cole <doncole at pacbell.net> Jul 03, 2006
- 612 views
Sergio Gelli wrote: > > Bom dia para todos. > Good morning for all > > I use with success the below code line: > > ii=invokeHandler(PushButton34, w32HClick, {}) > > But the next line don't work: > > ii = invokeHandler(PushButton34, VK_TAB, {}) > > The target is simulates the TAB key to change the focus > to another objects inside an windows. I also was try : > > ii = invokeHandler(WinMain1, VK_TAB, {}) > > But, this don't work too. > > How can I simulates a keystrok into a progran ? > > Many thanks. > > Sérgio Gelii - Brasil Hello Sergio, w32HClick is an event. VK_TAB is an attribute. Try: ii = invokeHandler(WinMain1, w32HClick, {}) Don Cole
3. Re: Keystrokes simulations
- Posted by Sergio Gelli <sergelli at uol.com.br> Jul 03, 2006
- 596 views
don cole wrote: > > Sergio Gelli wrote: > > > > Bom dia para todos. > > Good morning for all > > > > I use with success the below code line: > > > > ii=invokeHandler(PushButton34, w32HClick, {}) > > > > But the next line don't work: > > > > ii = invokeHandler(PushButton34, VK_TAB, {}) > > > > The target is simulates the TAB key to change the focus > > to another objects inside an windows. I also was try : > > > > ii = invokeHandler(WinMain1, VK_TAB, {}) > > > > But, this don't work too. > > > > How can I simulates a keystrok into a progran ? > > > > Many thanks. > > > > Sérgio Gelii - Brasil > > Hello Sergio, > > w32HClick is an event. > VK_TAB is an attribute. > > Try: ii = invokeHandler(WinMain1, w32HClick, {}) > > Don Cole Hi Don ii = invokeHandler(WinMain1, w32HClick, {}) It simulates a mouse click over WinMain1 I need simulates a TAB key down and others Thanks Sérgio Gelli - Brasil
4. Re: Keystrokes simulations
- Posted by don cole <doncole at pacbell.net> Jul 03, 2006
- 602 views
I goofed up that should have been: ii = invokeHandler(WinMain1, w32HKeyPress ,{}) Don Cole
5. Re: Keystrokes simulations
- Posted by Sergio Gelli <sergelli at uol.com.br> Jul 03, 2006
- 594 views
don cole wrote: > > I goofed up that should have been: > > ii = invokeHandler(WinMain1, w32HKeyPress ,{}) > > Don Cole Ok Dan, but How the control receives the key TAB ? Maibe I don't explain my problem exactly. I need simulates a TAB KEY to change the focus to another control. How I do it? Sérgio Gelli
6. Re: Keystrokes simulations
- Posted by "Greg Haberek" <ghaberek at gmail.com> Jul 03, 2006
- 614 views
> but How the control receives the key TAB ? > Maibe I don't explain my problem exactly. > I need simulates a TAB KEY to change the focus to another > control. With what you were doing, you'd have to do this: VOID = invokeHandler( WinMain1, w32KeyPress, {VK_TAB} ) > How I do it? This usually works to force focus to another control. setFocus( MyControl ) ~Greg
7. Re: Keystrokes simulations
- Posted by Larry Miller <larrymiller at sasktel.net> Jul 03, 2006
- 613 views
As a general principal, manipulating a program by means of simulating keyboard input is a bad idea that can lead to a number of difficult problems. There will almost always be a better way. In this particular case setFocus(id) would seem the best choice. Larry Miller
8. Re: Keystrokes simulations
- Posted by Sergio Gelli <sergelli at uol.com.br> Jul 03, 2006
- 594 views
Greg Haberek wrote: > > > but How the control receives the key TAB ? > > Maibe I don't explain my problem exactly. > > I need simulates a TAB KEY to change the focus to another > > control. > > With what you were doing, you'd have to do this: > > VOID = invokeHandler( WinMain1, w32KeyPress, {VK_TAB} ) > > > How I do it? > > This usually works to force focus to another control. > > setFocus( MyControl ) > > > ~Greg > > Hello Greg, I try it : VOID = invokeHandler( WinMain1, w32KeyPress, {VK_TAB} ) But it does nothing. I need change the focus control without setFocus() because it not make the Windows lost the exhibition order of the controls focus. Ex: I have 1,2,3,4 controls. The focus is on number 1. After do a setFocus(3) if press a Tab Key the focus go to the 2 controls, instead the 4. Pehalps don't exists how do a simulate Keystrokes in Win32 ? Sérgio Gelli
9. Re: Keystrokes simulations
- Posted by don cole <doncole at pacbell.net> Jul 03, 2006
- 608 views
Sergio Gelli wrote: > > don cole wrote: > > > > I goofed up that should have been: > > > > ii = invokeHandler(WinMain1, w32HKeyPress ,{}) > > > > Don Cole > > Ok Dan, > > but How the control receives the key TAB ? > Maibe I don't explain my problem exactly. > I need simulates This I don't undestand what you mean. I'm not critisizing because your English is much better than my Portuguese but "I need simulates" dosen't mean anything in English. Do you mean that you want a tab control to come to the top when key is pressed. Or do you want an icon to dance around or something when you hit a tab key? >a TAB KEY to change the focus to another > control. > How I do it? > > Sérgio Gelli Don Cole
10. Re: Keystrokes simulations
- Posted by don cole <doncole at pacbell.net> Jul 03, 2006
- 612 views
Hello Sergio, Put returnValue(-1) right before your setfocus() Don Cole
11. Re: Keystrokes simulations
- Posted by Sergio Gelli <sergelli at uol.com.br> Jul 03, 2006
- 604 views
don cole wrote: > > Sergio Gelli wrote: > > I need simulates > > This I don't undestand what you mean. I'm not critisizing because your > English > is much better than my Portuguese but "I need simulates" dosen't mean anything > in English. Do you mean that you want a tab control to come to the top when > key is pressed. Or do you want an icon to dance around or something when you > hit a tab key? > > >a TAB KEY to change the focus to another > > control. > > How I do it? > > > > Sérgio Gelli > > > Don Cole O.K Sorry my bad English. Perhaps you are not certain on my Portuguese:) Please, forget everything that was written before. I need to order a key to an application, by a line of code in Euphotia, not by the keyboard. Sérgio Gelli
12. Re: Keystrokes simulations
- Posted by Bernie Ryan <xotron at bluefrog.com> Jul 03, 2006
- 594 views
Sergio Gelli wrote: > > O.K Sorry my bad English. > Perhaps you are not certain on my Portuguese:) > > Please, forget everything that was written before. I need to order > a key to an application, by a line of code in Euphotia, not by the keyboard. > > Sérgio: If you want to send a key to window program then look at this program code in Archive. http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=sendkey Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan
13. Re: Keystrokes simulations
- Posted by "Greg Haberek" <ghaberek at gmail.com> Jul 03, 2006
- 597 views
> I try it : > VOID = invokeHandler( WinMain1, w32KeyPress, {VK_TAB} ) > But it does nothing. Correct. This only does what it says. This invokes the handler for w32KeyPress on the control WinMain1 with parameter VK_TAB. If you do not have a handler set up, then nothing will happen. > I need change the focus control without setFocus() because > it not make the Windows lost the exhibition order of the controls focus. > Ex: I have 1,2,3,4 controls. The focus is on number 1. > After do a setFocus(3) > if press a Tab Key the focus go to the 2 controls, instead the 4. Do not use such numbers as 1, 2, or 3. You must use the control id from create(). So if you want to go from Button1 to Button2, simply call setFocus( Button2 ) when required. > Pehalps don't exists how do a simulate Keystrokes in Win32 ? See Sendkeys by PatRat in the Archive. http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=sendkeys ~Greg
14. Re: Keystrokes simulations
- Posted by Sergio Gelli <sergelli at uol.com.br> Jul 03, 2006
- 603 views
Greg Haberek wrote: > > > > Pehalps don't exists how do a simulate Keystrokes in Win32 ? > > See Sendkeys by PatRat in the Archive. > > <a > href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=sendkeys">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=sendkeys</a> > > ~Greg > Hi Greg And thanks to all Eu Forum people The Sendkeys.ew write By Thomas Parslow, was resolved my problem. I am learning English so: send keys = simulate keystroks (in my poor translation):) :_) Sorry again. Sérgio Gelli.
15. Re: Keystrokes simulations
- Posted by Derek Parnell <ddparnell at bigpond.com> Jul 04, 2006
- 631 views
Sergio Gelli wrote: > I use with success the below code line: > > ii=invokeHandler(PushButton34, w32HClick, {}) > > But the next line don't work: > > ii = invokeHandler(PushButton34, VK_TAB, {}) That function is used to call the user defined handler for one of the win32lib event types, and not used to simulate keystrokes. > The target is simulates the TAB key to change the focus > to another objects inside an windows. Here is a sample program that could help you...
include win32lib.ew without warning integer Win integer box1 integer box2 integer box3 integer box4 integer btn1 integer SB function change_focus(sequence pName) integer newid newid = getNameId(pName) if newid > 0 then setFocus(newid) end if return newid end function procedure onFocus_id(atom id, atom event, sequence params) setText(SB, "Focus is now on '" & getIdName(id) & "'") end procedure procedure Key_Box4(atom id, atom event, sequence params) if params[1] = VK_ENTER then if change_focus(getText(id)) > 0 then setText(id, "") -- clear the name of the control returnValue(-1) -- tell win32lib to not auto setfocus on return end if end if end procedure procedure Click_Btn1(atom id, atom event, sequence params) setFocus(box1) end procedure procedure main() Win = create( Window, "TEST", 0, 50, 50, 300, 200,0 ) box1 = create( EditText, "Box 1", Win, 5, 10, 90, 22, 0) box2 = create( EditText, "Box 2", Win, 5, 40, 90, 22, 0) box3 = create( EditText, "Box 3", Win, 5, 70, 90, 22, 0) box4 = create( EditText, "Box 4", Win, 105, 10, 90, 22, 0) btn1 = create( Button, "Set Focus", Win, 105,110, 90, 22, 0) SB = create( StatusBar, "", Win, 0, 0, 0, 0, 0) setText(btn1, "Goto Box 1") setHint(box4, "Enter the name of control to set focus to it.") setHandler({box1,box2,box3,box4,btn1},w32HGotFocus, routine_id("onFocus_id")) setHandler(btn1, w32HClick, routine_id("Click_Btn1")) setHandler(box4, w32HKeyPress, routine_id("Key_Box4")) WinMain({Win, box1},Normal) end procedure main()
Please note that when the Enter key is pressed in an EditText control, Win32lib will automatically move focus to the next control. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell