moving focus to an Edit Control box

Hello! I'm new to this stuff, so please go easy!

I've got an Edit Control ActiveX box that I'm using to process keyboard input (getting the MCE remote control to work in my menu). It works like a champ, but I don't want the box with the cursor in it to be visible, so I've got it off-screen.

What I'd like is a button on the screen that you can click on to "enable remote control" -- all I need it to do is move the focus to the Edit Control box so that the cursor appears in it... and I can't figure out how to do it.

Is there a way to do this directly in script? Alternately, can you create a fake mouse click at a given point on the screen?

Thanks for any info you might have,

-VRS
3,220 views 5 replies
Reply #1 Top
I think I understand what you're trying to do. Give your ActiveX Edit Control an Object ID. Just right-click on the DesktopX Builder Icon in your systray, select List Objects and find your off-screen object(in the object list), right click and select properties. From there go to the Summary tab and give it an Object ID name. Then create a visible Object, make it an Object Type Object Controller and have it control the object you named(ordinarily this method is used to toggle an object, so I'm thinking this should work. Let me know.  
Reply #2 Top
I tried the object-controller method... It DOES successfully toggle the edit control from visible to invisible and back, but it doesn't ever give it focus and put the cursor in the box.   

Any off-the-wall hackery-type ideas I could try from anyone? I think I've tried everything that's documented...   

Thanks,

VRS
Reply #3 Top
Have you tried Object.SetFocus?

Sub Object_OnLButtonUp(x, y, d)
If d Then Exit Sub
DesktopX.Object("MyEditBox").SetFocus
End Sub

In your button's script should do it.
Reply #4 Top
Yes!

Thank you rabidrobot, that's precisely what I needed. Works beautifully.

  

-VRS
Reply #5 Top
Is it possible to give focus to the last active window?