Hello,
I'm going to create a special-shaped control.
It looks like this, there are 5 buttons in it.
I'm not sure what is a good way to this goal.
As I know, widgets always take a rectangle area. It is impossible to make a widget occupy some area of another one?
So, I may create a combined widget which contain some shaped area as buttons myself. Should I draw with wxControl's OnPaint directly or wxGLCanvas?
Need suggestions about creating special-shaped widget from wxControl or draw them with OpenGL Topic is solved
Re: Need suggestions about creating special-shaped widget from wxControl or draw them with OpenGL
Hi,
Take a look at the shaped sample.
Thank you.
Take a look at the shaped sample.
Thank you.
Re: Need suggestions about creating special-shaped widget from wxControl or draw them with OpenGL
Hello,
I browsed shaped.cpp.
Seems only wxNonOwnedWindow can have a shape. But its derived window is "non-child windows".
I browsed shaped.cpp.
Seems only wxNonOwnedWindow can have a shape. But its derived window is "non-child windows".
No, I know everything.
Re: Need suggestions about creating special-shaped widget from wxControl or draw them with OpenGL
I don't think you'll be able to make 1-5 individual windows as their boxes would overlap. But it should be possible to make the whole thing a custom control, but you'd have to handle mouse events on the 5 individual areas yourself.
On top of that, you'll probably wait until this PR is applied to the master branch: https://github.com/wxWidgets/wxWidgets/pull/23498
On top of that, you'll probably wait until this PR is applied to the master branch: https://github.com/wxWidgets/wxWidgets/pull/23498
Use the source, Luke!
Re: Need suggestions about creating special-shaped widget from wxControl or draw them with OpenGL
ONEEYEMAN, doublemax,
Thank you for the suggestion.
I made a little change then used a chip solution (though have a limitation) which allow some overlap between controls.
1. Add a panel with XRC, create 5 buttons in the panel with code.
2. Create button images with alpha channel, background should be transparent.
3. Adjust their position. There will be some overlap area between the 5 buttons. Need ensure that the overlap area is all background, no foreground in it, or one foreground will be overwrite by another background.
4. Add wxBORDER_NONE flag to button style.
Thank you for the suggestion.
I made a little change then used a chip solution (though have a limitation) which allow some overlap between controls.
1. Add a panel with XRC, create 5 buttons in the panel with code.
2. Create button images with alpha channel, background should be transparent.
3. Adjust their position. There will be some overlap area between the 5 buttons. Need ensure that the overlap area is all background, no foreground in it, or one foreground will be overwrite by another background.
4. Add wxBORDER_NONE flag to button style.
No, I know everything.