It would be better if wxSpinCtrl can mark its value validated and selected after press enter Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
User avatar
JohnKnow
Knows some wx things
Knows some wx things
Posts: 41
Joined: Tue Aug 31, 2021 4:14 am

It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by JohnKnow »

In some case, I need change a value frequently to see it effect.
wxSpinCtrl now only mark its value validated after lose focus, while I need change its value again and again. It's not convenient.

I think wxSpinCtrl will be better with below two features:
1. Update value after press enter, and make its value selected will be convenient to change it again.
2. Add a property to set the change step after press its arrow button. Some times it value range is bit, change it 1 by 1 is two slow.
No, I know everything.
User avatar
doublemax
Moderator
Moderator
Posts: 19103
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by doublemax »

JohnKnow wrote: Tue Nov 23, 2021 6:00 am I think wxSpinCtrl will be better with below two features:
1. Update value after press enter, and make its value selected will be convenient to change it again.
2. Add a property to set the change step after press its arrow button. Some times it value range is bit, change it 1 by 1 is two slow.
I think both issues could be solved by subclassing wxSpinCtrl and handling (and then skipping) the wxEVT_TEXT_ENTER and wxEVT_SPINCTRL events.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by ONEEYEMAN »

Hi,
Problem 2 can be solved by using wxSpinCtrlDouble.

Thank you.
User avatar
JohnKnow
Knows some wx things
Knows some wx things
Posts: 41
Joined: Tue Aug 31, 2021 4:14 am

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by JohnKnow »

Hi doublemax, ONEEYEMAN,

Thank you for the reply, I would like to subclass wxSpinCtrl now.
No, I know everything.
User avatar
doublemax@work
Super wx Problem Solver
Super wx Problem Solver
Posts: 472
Joined: Wed Jul 29, 2020 6:06 pm
Location: NRW, Germany

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by doublemax@work »

JohnKnow wrote: Wed Nov 24, 2021 1:04 am Hi doublemax, ONEEYEMAN,

Thank you for the reply, I would like to subclass wxSpinCtrl now.
Was that just a statement or a request for help regarding this task?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by PB »

JohnKnow wrote: Wed Nov 24, 2021 1:04 am Thank you for the reply, I would like to subclass wxSpinCtrl now.
Just so you know...

Unlike for a textbook C++ class, subclassing a wxWidgets control may not be easy, as there may be different implementation (classes) for individual platforms, which just have the same public interface but their internals can considerably differ.

Looking at the docs, there are no documented virtual methods to override in wxSpinCtrl...
User avatar
JohnKnow
Knows some wx things
Knows some wx things
Posts: 41
Joined: Tue Aug 31, 2021 4:14 am

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by JohnKnow »

doublemax@work wrote: Wed Nov 24, 2021 11:02 am Was that just a statement or a request for help regarding this task?
I fact, it is a request or suggestion for new feature/improvement.

But ehh,, I can do it mysefl when I'm free if the org doesn't have such plan.
No, I know everything.
User avatar
JohnKnow
Knows some wx things
Knows some wx things
Posts: 41
Joined: Tue Aug 31, 2021 4:14 am

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by JohnKnow »

PB wrote: Wed Nov 24, 2021 11:46 am Looking at the docs, there are no documented virtual methods to override in wxSpinCtrl...
Hi PB,
I see, wxSpinCtrl has no virtual method. But it is drived from wxEvtHandler.
I guess, it could be possible to subclass it and add an event handler to its event table, or just bind a handler function to the control.

I will try it, or just change the official code then request to pull when I'm free. I have to live with it now because I'm rushing for my work :D
No, I know everything.
User avatar
JohnKnow
Knows some wx things
Knows some wx things
Posts: 41
Joined: Tue Aug 31, 2021 4:14 am

Re: It would be better if wxSpinCtrl can mark its value validated and selected after press enter

Post by JohnKnow »

ONEEYEMAN wrote: Tue Nov 23, 2021 8:16 pm Hi,
Problem 2 can be solved by using wxSpinCtrlDouble.

Thank you.
Thank you ONEEYEMAN, wxSpinCtrlDouble is pretty good.
No, I know everything.
Post Reply