SF.net SVN: mahogany: [7271] trunk/M

[email protected]
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7271
          http://svn.sourceforge.net/mahogany/?rev=7271&view=rev
Author:   vadz
Date:     2007-05-18 05:21:26 -0700 (Fri, 18 May 2007)

Log Message:
-----------
corrected restoring of wxPListbook pages

Modified Paths:
--------------
    trunk/M/include/wx/persctrl.h
    trunk/M/src/wx/generic/persctrl.cpp

Modified: trunk/M/include/wx/persctrl.h
===================================================================
--- trunk/M/include/wx/persctrl.h	2007-05-11 01:07:25 UTC (rev 7270)
+++ trunk/M/include/wx/persctrl.h	2007-05-18 12:21:26 UTC (rev 7271)
@@ -180,7 +180,7 @@
 
     // callbacks
         // when we're created, we restore our page
-    void OnCreate(wxWindowCreateEvent& event);
+    void OnSize(wxSizeEvent& event);
 
 protected:
     static const wxChar *ms_path;

Modified: trunk/M/src/wx/generic/persctrl.cpp
===================================================================
--- trunk/M/src/wx/generic/persctrl.cpp	2007-05-11 01:07:25 UTC (rev 7270)
+++ trunk/M/src/wx/generic/persctrl.cpp	2007-05-18 12:21:26 UTC (rev 7271)
@@ -73,7 +73,7 @@
 #if wxUSE_LISTBOOK
 
 BEGIN_EVENT_TABLE(wxPListbook, wxListbook)
-    EVT_WINDOW_CREATE(wxPListbook::OnCreate)
+    EVT_SIZE(wxPListbook::OnSize)
 END_EVENT_TABLE()
 
 #endif // wxUSE_LISTBOOK
@@ -430,9 +430,13 @@
     delete m_persist;
 }
 
-void wxPListbook::OnCreate(wxWindowCreateEvent& event)
+void wxPListbook::OnSize(wxSizeEvent& event)
 {
-    if ( m_bFirstTime ) {
+    // the control gets a dummy resize event when the first page is added to
+    // it, as we usually have more than one page (and there is only one it
+    // doesn't matter if we restore selection or not anyhow), wait a bit more
+    // before restoring selection
+    if ( m_bFirstTime && GetPageCount() > 1 ) {
         RestorePage();
 
         m_bFirstTime = FALSE;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.