custom class to manage controls Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

custom class to manage controls

Post by saifcoder »

Hello, in my project, i need a Class to manage controls (Create, Change, Get, Set..), but didn't work for me !

Needs :

Code: Select all

Controls_Manager MyButton("Button", This, wxT("Caption"), wxPoint(20,30), wxSize(120, 35) );

wxPoint Test1 = MyButton.Get_Position();

MyButton.SetLabel("New Caption");

MyButton.Destroy();
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: custom class to manage controls

Post by eranon »

Hello,

What is your question ? Every type of control has its own requirements and not sure to understand the benefit to create a wrapper which will simply call the underlying method for the concerned control class. Also, knowing you add a level of abstraction, you'll have to figure-out the type of each afterward (eg. relying on RTTI capability) , everytime you'll need to call a method on one... Unless specific need, it sounds a little complex for nothing for me.

Or I missed the point and you only need to manage a single type of control (eg. wxButton only) and, in this case, I don't see the difficulty obviously.
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: custom class to manage controls

Post by ONEEYEMAN »

Hi,
On top of eranon' response - "didn't work for me" is very vague and my "Crystal Ball" is out of reach at the moment.

Thank you.
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 80
Joined: Thu Nov 16, 2017 9:32 pm

Re: custom class to manage controls

Post by saifcoder »

First, i post this Topic quickly (at work), and i forget to attach Code Source !, Sorry.

Yes Eranon, you are right, even if this Class will manage only one type of control, this still "little complex for nothing", so i will tray to use "native" method !

Thank you
Debian 9 - GCC 6 - wxWidgets 3.x U
Win 10 - GCC 8 - wxWidgets 3.x U
Mac OS X 10.x - Clang - wxWidgets 3.x U
i am in love with WX. Yes.
Post Reply