|
win_set_window questions |
mail frank
Member #6,213
September 2005
|
Here is the description about win_set_window function: " ... I'm using this function in a wxWidget application. Inside the constructor of a wxFrame, I passed the HWND handler to win_set_window. Unfortunately it seems the EVT_PAINT event will not triggered anymore. Does anybody know the reason? By the way, if I want to port my application to other platforms, are there any simular function like win_set_window in other platforms ( for example linux, max ox )? |
CGamesPlay
Member #2,559
July 2002
|
Nope. Once you use win_set_window, you're stuck with Windows. Also, you're going to have to show us some code describing the problem. -- Ryan Patterson - <http://cgamesplay.com/> |
mail frank
Member #6,213
September 2005
|
Here is part of my code: //------------------------------- IMPLEMENT_APP(MyApp); bool MyApp::OnInit() //------------------------------------ #include <wx/wxprec.h> #ifdef _BORLANDC_ #include <wx/frame.h> class CAllegroWin; class wxAllegroFrame: public wxFrame enum Identifiers void OnClose(wxCloseEvent& event); private: DECLARE_EVENT_TABLE() #endif //--------------------------------- BEGIN_EVENT_TABLE(wxAllegroFrame,wxFrame) wxAllegroFrame::wxAllegroFrame(wxWindow* parent,wxWindowID id,const char* data) SetClientSize(640,480); HANDLER handler = (HANDLER)GetHandle(); int width,height; wxAllegroFrame::~wxAllegroFrame() void wxAllegroFrame::OnPaint(wxPaintEvent& event) void wxAllegroFrame::OnClose(wxCloseEvent& event) //----------------------------------- #include "pre.h" #ifdef _WXMSW_ class CAllegroWin void showText(); private: #endif // CALLEGROWIN_H //----------------------------------- CAllegroWin::CAllegroWin(HANDLER handler,int w,int h) if (allegro_init() != 0) install_keyboard(); if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, w, h, 0, 0) != 0) CAllegroWin::~CAllegroWin() void CAllegroWin::showText() /* clear the screen to white */ /* you don't need to do this, but on some platforms (eg. Windows) things /* write some text to the screen with black letters and transparent background */ /* you must always release bitmaps before calling any input functions */ } I can catch the OnClose event without problem. But I can't catch OnPaint event. |
CGamesPlay
Member #2,559
July 2002
|
I can't read that, sorry. Please use [code] tags... See http://www.allegro.cc/mockup.html. Edit your post to add that and I'll try again -- Ryan Patterson - <http://cgamesplay.com/> |
mail frank
Member #6,213
September 2005
|
I repost my source code.
|
BAF
Member #2,981
December 2002
|
Hmm, looks interesting, I'll have to check into that later, mail frank. |
mail frank
Member #6,213
September 2005
|
I've changed the program a bit. Now I'm passing wxWindow handle to Allegro, then I add the window into a frame. Inside the frame, you even can add some other panels. Through the "OnPaint" event in frame or menu item "about", you can see "Hello, World!" displayed by Allegro. But still there is nothing happen in wxWindow's "OnPaint" event, it seems Allegro filter out the "OnPaint" event. Please refer to my attachment for all my source code for testing. |
Hrvoje Ban
Member #4,537
April 2004
|
There was a thread about WM_PAINT message not being sent. IIRC Windows won't send that message unless window gets changed in way they can detect it (minimized and restored, overlapped by other window, etc). Try triggering OnPaint event manually. |
mail frank
Member #6,213
September 2005
|
There is no WM_PAINT message even when I resize the window. |
|