Extending wx controls

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
SSteven
Earned a small fee
Earned a small fee
Posts: 14
Joined: Fri Sep 04, 2015 7:03 am

Extending wx controls

Postby SSteven » Fri Jan 15, 2016 8:51 am

Hi

1) Is it possible to extend wx controls, say, in order to give them additional properties?

2) Is it possible to use a Designer to set the values of these new wx control properties (the ones added) at design time? If so, which designer has this capability?

Thanks
Steven

User avatar
doublemax
Moderator
Moderator
Posts: 12320
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Extending wx controls

Postby doublemax » Fri Jan 15, 2016 10:21 am

1) Is it possible to extend wx controls, say, in order to give them additional properties?
That depends on what you want to change, on the control itself and eventually even on the platform. If a control is implemented with a native control (which is always the aim in wxWidgets), extending its functionality may be hard or even impossible.

For generic controls (that are implemented without an underlying native control) like wxGrid or wxDataViewControl, the chances are much better.

2) Is it possible to use a Designer to set the values of these new wx control properties (the ones added) at design time? If so, which designer has this capability?
Not that i know if.

Can you give an example of what you have in mind?
Use the source, Luke!

SSteven
Earned a small fee
Earned a small fee
Posts: 14
Joined: Fri Sep 04, 2015 7:03 am

Re: Extending wx controls

Postby SSteven » Thu Jan 21, 2016 9:05 am

Thanks for the reply.

1) Lets consider the case where the control is implemented as a native control. In this case, I'm guessing that the wx control would be a wrapper for the native control. If so, it should be possible to extend the wrapper control (but obviously not the underlying native control, which is anyway unnecessary).

In case it is not possible to extend the wrapper (for some reason), one can, at the app level, create a custom control which wraps the wx control and give it additional custom properties. This would serve the requirement.

2) More difficult is the Designer. I'd love the designer to be able to set these custom properties on the control. (This kind of functionality is available for the WPF designer and also the Windows forms designer, where one can set custom properties at design time.)

An example would be as follows (I'm using pseudo-code):

Code: Select all

control myTextBox : wxTextBox
{
    private wxTextBox wtb;   // the wrapped TextBox

    // custom properties
    private String s1;
    private String s2;
    private int i1;
    ...

    myTextBox(wxTextBox w)  // ctor
    {
           wtb = w;
    }
}


_Some_ of these custom properties should be settable at custom time in the Designer. If this not possible, is there a workaround?

Thanks
Steven

User avatar
doublemax
Moderator
Moderator
Posts: 12320
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Extending wx controls

Postby doublemax » Thu Jan 21, 2016 9:42 am

If this not possible, is there a workaround?
I don't use and GUI designer myself, so i don't know if any of them supports this. I also can't think of a workaround.
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2468
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Extending wx controls

Postby ONEEYEMAN » Tue Mar 08, 2016 3:42 pm

Hi,
Can you give an example of what you are trying to do? Maybe it is already been done and you can just use it straight ahead.

In terms of the GUI designer: there are many different RAD tools that is designed specifically to work with wxWidgets. Usually people/companies select one tool and stick with it in order to do the development.

If this property is not implemented and you need it in the RAD tool - you best bet would be to create a poll asking if such a tool/workaround exists.

Thank you.


Return to “Component Writing”

Who is online

Users browsing this forum: No registered users and 2 guests