hi,
is it possible to have a button on top of a device context?
i would like to have a button that only shows on top of a dc when the mouse is within the dc.
thanx!
wxButton on top of wxDC Topic is solved
A device context is not a visible object, it's more like a helper class to paint onto windows, printers or into bitmaps.
So the expression "button on top of a dc" doesn't make much sense.
You could just put a button onto a wxPanel, catch the xEVT_ENTER_WINDOW and wxEVT_LEAVE_WINDOW event on the panel and show/hide the button as you like.
So the expression "button on top of a dc" doesn't make much sense.
You could just put a button onto a wxPanel, catch the xEVT_ENTER_WINDOW and wxEVT_LEAVE_WINDOW event on the panel and show/hide the button as you like.
Use the source, Luke!
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
alright, this worked, thanx!
.... BUT ....
as soon as i have a sizer in the wxScrolledWindow, according to http://docs.wxwidgets.org/2.8.8/wx_wxsc ... lledwindow it overrides the possibility to set the pageSize via setScrollbars or SetScrollPageSize. i tried a couple of workarounds but none worked
the final aim is to have a bitmap that can be scrolled and a slider for zooming the bitmap plus a button for opening a config menue in another window. the zoom slider and config button should not scroll with the image, so the sizer size schould always stay the same.
any ideas?
thanx!
.... BUT ....
as soon as i have a sizer in the wxScrolledWindow, according to http://docs.wxwidgets.org/2.8.8/wx_wxsc ... lledwindow it overrides the possibility to set the pageSize via setScrollbars or SetScrollPageSize. i tried a couple of workarounds but none worked
the final aim is to have a bitmap that can be scrolled and a slider for zooming the bitmap plus a button for opening a config menue in another window. the zoom slider and config button should not scroll with the image, so the sizer size schould always stay the same.
any ideas?
thanx!
I don't see why you'd put the button and the slider onto the image panel (which is probably your wxScrolledWindow)
I'd do it like this:
I hope this is clear enough
But then the button wouldn't be on top of the image, which was your initial question, so i'm not sure if this is what you want.
I'd do it like this:
Code: Select all
main panel
-vertical sizer
--wxScrolledWindow
--horizontal sizer
---slider
---button
But then the button wouldn't be on top of the image, which was your initial question, so i'm not sure if this is what you want.
Use the source, Luke!
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
i was thinking about something like in google maps, where you have the zoomSlider and the buttons on top of the map. slider and buttons always stay in the same position, only the picture below is moved by scrollbars or dragging.
do you think this is possible with wxWidgets?
thank you for your input and time!
do you think this is possible with wxWidgets?
thank you for your input and time!
Possible, but will be some work if you want something that looks good
Major downside when using standard controls for button and slider: The background can't shine through transparently or even with a mask. Especially the slider will look ugly when put above a custom background (your image).
Option 1:
use wxScrolledWindow for image display
don't use sizers
place controls at absolute position
when window scrolls, adjust controls' position so that they appear to be stationary
Disadvantage: Position of the controls will flicker (totally unacceptable IMO)
Option 2:
use normal wxPanel for image display
put separate wxScrollBars above and next to panel using sizer (if you really need them, Google maps doesn't have them)
Advantage: Position of the controls will not flicker
Disadvantage: You have to code everything yourself what usually wxScrolledWindow would do for you: Handling virtual area, scroll position, scrollbar handling etc.
Standard controls will still look ugly
Option 3 (What i'd do):
Like 2), but even code the controls (button, slider) yourself and render them yourself when you render the image
You might be tempted to use a wxScrolledWindow together with custom drawn controls, but there will be a problem:
When you scroll only one line in any direction, the OS will just copy the content of the window and send a redraw request only for the small stripe that actually changed. But when you have stationary content over a dynamic background you need to do a full redraw each time. If you manually force a full redraw on each scroll event, you'll get heavy flicker again.
Major downside when using standard controls for button and slider: The background can't shine through transparently or even with a mask. Especially the slider will look ugly when put above a custom background (your image).
Option 1:
use wxScrolledWindow for image display
don't use sizers
place controls at absolute position
when window scrolls, adjust controls' position so that they appear to be stationary
Disadvantage: Position of the controls will flicker (totally unacceptable IMO)
Option 2:
use normal wxPanel for image display
put separate wxScrollBars above and next to panel using sizer (if you really need them, Google maps doesn't have them)
Advantage: Position of the controls will not flicker
Disadvantage: You have to code everything yourself what usually wxScrolledWindow would do for you: Handling virtual area, scroll position, scrollbar handling etc.
Standard controls will still look ugly
Option 3 (What i'd do):
Like 2), but even code the controls (button, slider) yourself and render them yourself when you render the image
You might be tempted to use a wxScrolledWindow together with custom drawn controls, but there will be a problem:
When you scroll only one line in any direction, the OS will just copy the content of the window and send a redraw request only for the small stripe that actually changed. But when you have stationary content over a dynamic background you need to do a full redraw each time. If you manually force a full redraw on each scroll event, you'll get heavy flicker again.
Use the source, Luke!