I have a CTextEdit sitting inside a view container. When the view opens, I’d like to programmatically select the edit control so that the cursor is blinking at the character 0 position (left edge) and if the user hits a key, it will begin filling in that control - i.e. the control is “pre-selected” and ready for input. I can do this manually by clicking in the control, and I’ve tried sending mouse clicks from the View Container into the edit control itself to mimic that with no luck. I thought I’d check here to see if perhaps there is a simple solution and I am overthinking it. I did a search here first, but didn’t find anything. Thanks for any advice - Will
How about calling setFocus
on the text edit? It should do exactly what you describe.
Thanks, Arne. I have tried both the setFocusView( ) with the frame* as well as takeFocus() without success. I am on 4.13.3 and so I am guessing setFocusView( ) is what you are referring to. If not LMK. Also, I need to have this happen any time the view is refreshed (which means clearing out this edit control and re-selecting it). But I feel like I have done this long ago…so perhaps my view hierarchy is off as I have another view container layer involved. I will keep drilling. Meantime, it is nice to know that it is (still) possible. I was fearing that there might be a platform-control issue with edit controls… Thanks again.