Search code examples
c++wxwidgets

WX: attempting to select value when clicking a text field


We are implementing a text field to do numeric entry. We subclass the standard wxTextCtrl. Behavior is that when user decides to edit the value they get a full precision version and it is selected.

First attempt was to override the focus handler so that when the field gets focus the value is shown in full and selected. This works great except for the cases when you click on the field. In that case, the focus handler is called and the value is selected...but some time after that it is deselected and the edit point put where the mouse click occurred. I thought maybe I could override SetSelection and set a debug point but it seems to use some other method to set the selection! I'm stuck having to walk through the miles of event handling crap to figure it out...I'm thinking in the mouse button handlers but so far I haven't found any.

It would be nice if someone who might already know what I need to override to point it out. Where do I need to be looking?


Solution

  • Answer is that it can't be done. The behavior I'm trying to override is implemented by the win32 component itself and wx doesn't provide any method to doing so....short of bypassing WX to get the win32 handle and using win32 api.

    Would need to write a new component in the WX api to get the desired behavior.