1. getting a DC with wx
- Posted by SDPringle Jun 07, 2009
- 776 views
I've got wxWidgets going with EUPHORIA 4.0. I want to know, how do I get a 'DC' out of an object using WxEuphoria? I don't see the constructor analog anywhere.
Shawn Pringle
2. Re: getting a DC with wx
- Posted by SDPringle Jun 07, 2009
- 826 views
Are Controls and Frames special case DCs? How do I copy them? How do I let wx know that I want it to update the Window?
3. Re: getting a DC with wx
- Posted by mattlewis (admin) Jun 07, 2009
- 866 views
Are Controls and Frames special case DCs? How do I copy them? How do I let wx know that I want it to update the Window?
What exactly are you trying to do? And when? Within an onPaint event, you simply create a wxPaintDC. There are also wxMemoryDCs for manipulating images.
Matt
4. Re: getting a DC with wx
- Posted by SDPringle Jun 07, 2009
- 824 views
I am trying to create an example line-break conversion program to better understand wxWidgets. I want to update a status bar. So, I use wx_puts for that. I want to print in red for errors and green for regular messages. If I have two DCs for the same control can I set one to red and the other to green and then use one for error and one for info?
Without specifying DCs I call wx_puts() on the Window but nothing appears until I obscure the window and raise it again.
procedure output_wx( sequence fmt, sequence s, integer dc ) if clearStatusFlag then statusText = sprintf( fmt, s ) else statusText &= sprintf( fmt, s ) end if gui:begin_drawing( statusBar ) ifdef DC then gui:wx_puts( {statusBar,4,4,dc}, statusText ) elsedef gui:wx_puts( {statusBar,4,4}, statusText ) end ifdef gui:end_drawing( statusBar ) clearStatusFlag = statusText[$] = '\n' end procedure
The event that calls everything is the drag and drop event.
Shawn Pringle
5. Re: getting a DC with wx
- Posted by ghaberek (admin) Jun 08, 2009
- 845 views
wx_puts() is graphics-based, which means your text will be erased on the next wxEVT_PAINT event. You would have to store the text somewhere and repaint it again during that event. Why not just use set_status_text() instead?
-Greg
6. Re: getting a DC with wx
- Posted by SDPringle Jun 14, 2009
- 819 views
Thanks Greg. That solves the problem. Is there away to artificially trigger a PAINT event so that the Window will update itself?
7. Re: getting a DC with wx
- Posted by mattlewis (admin) Jun 14, 2009
- 838 views
Thanks Greg. That solves the problem. Is there away to artificially trigger a PAINT event so that the Window will update itself?
If you want to draw outside of a wxPAINT event, you can use a wxClientDC. It appears to be undocumented in wxEuphoria for some reason (I see documentation markup for it in the source, but it's not in the published docs), but it's there, and you can use it just like a wxPaintDC.
Matt
8. Re: getting a DC with wx
- Posted by ghaberek (admin) Jun 14, 2009
- 873 views
- Last edited Jun 15, 2009
If you want to draw outside of a wxPAINT event, you can use a wxClientDC. It appears to be undocumented in wxEuphoria for some reason (I see documentation markup for it in the source, but it's not in the published docs), but it's there, and you can use it just like a wxPaintDC.
You can also call refresh_window() to trigger a manual repaint. My suggestion would be to create a wxMemoryDC from a wxBitmap, draw to that, then blit() it to the window when needed (either manually or during a paint). This sort of cached double-buffering is probably the most efficient method.
-Greg