Jump to content

Recommended Posts

Posted (edited)

I work on an MDI application with the main frame being a wordprocessing window. For some reason, it takes two clicks on this frame in order to get focus. I hate that. I am trying to write a small script that would allow a single click focus.

Unfortunately, all of the controls on the WP frame are hidden and there are a lot of them. The control that would seem to be the most important to obtain focus is probably "TRichEdit1".

So,

ControlFocus ("Application", "", "TRichEdit1")

and

ControlClick ("Application", "", "TRichEdit1")

do not work. (The caret does not move to the window frame)

Is there any way of getting focus of a hidden control?

Thanks

Edited by fmen
Posted

I am not sure if I understand correctly but here goes.

Try using WinActivate


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Posted

I am not sure if I understand correctly but here goes.

Try using WinActivate

WinActivate will activate the entire MDI "Application", not the the area in question.

Is there any way of getting focus of a hidden control?

Posted

If you are trying to write to a part of the application you could always try ControlSend.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Posted

WinActivate will activate the entire MDI "Application", not the the area in question.

Is there any way of getting focus of a hidden control?

Yes!!!

ControlEnable seems to do the trick. Thanks.

Posted

...ControlEnable seems to do the trick. Thanks.

You are welcome.

I've never used ControlEnable - so it truely was grasping at straws for me...

[size="1"][font="Arial"].[u].[/u][/font][/size]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...