Link to home
Start Free TrialLog in
Avatar of AgentSmith007
AgentSmith007

asked on

Cut, Copy, Paste [Text Only]

OK, This one has been bugging me for awhile. I have a top-level form that has a toolbar w/ Cut, Copy, Paste buttons. Inside this form I have a series of custom controls that also could potentially have other forms inside (loaded from a .dll via reflection), ultimately ending at a textbox that might or might not have focus. I'm just trying to get this clipboard functionality working universally, regardless of what form this textbox is a control of. I've already tried doing me.form.activeform.activecontrol & this just returns a reference to the top-level custom control.

Does anyone have some code that will drill through the focus forms/controls until it ultimately ends up at the focus textbox? As ugly as it sounds, I'm ready to just make these buttons emulate Ctrl-C, Ctrl-X, and Ctrl-V !! Please help. Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AgentSmith007
AgentSmith007

ASKER

Bob,

This helps greatly. I am not, however, looking based on name and type. I guess my criteria for returning the valid control is if it passes the type check AND it has focus. Is there a property of the textbox or shared control property that lets me check if the control currently has focus?

Scott
Don't worry about re-writing your code to reflect the type only needed, I've done that, I just need to know how to check if a control has focus.
This isn't easily apparent, but there is the Control.Focused property.  The reason it's not apparent is that the auto-complete doesn't show this property.  You just have to know it's there.  

Bob
Hmm, well focused didn't work but either way I think I can work it out from here. Thanks for your help!