Hi Guys,
I am working on an app at work, and in Delphi (VCL) there are
components to store the state of a form and sub children if needed
(position / size etc).
That made me wonder, why isn't this in wxWidgets by default? It would
not require much to be done.
wxApp::AssignConfig(wxConfigBase *)
Which takes a pointer to a wxConfigBase * class to be owned by the
app. This seems to be the most logical place as the wxApp is the last
to be killed.
This way a wxConfig class is at least available for sub forms to be
used as there is wxGetApp() as macro to get the current app instance.
As last there needs to be wxApp::SaveWindowPos / wxApp::LoadWindowPos
where a relative key can be given like;
wxGetApp().SaveWindowPos(wxT("mainwindow"), this);
This would not require much change and can be used for all windows to
be stored. I am always hand coding the saving of windows states and
sizes so why not make that a wxApp method with a wxConfig class that
can be assigned to store the size / pos ?
With regards,
- Jorgen
Still i use this to have that wxConfigBase pointer which i can get to
from anywhere.
wxFileConfig *pConfig = new wxFileConfig("SlideComposer");
wxConfigBase::Set( pConfig );
would it not be better to include here:
SaveWindowPos(wxT("mainwindow"), this);
or maybe better:
wxConfigBase::Write(*const wxString <wx_wxstring.html#wxstring>&
*/key/, wxWindow*theWindow )
Maybe more interesting things/types to save?
wxConfigBase::Write(*const wxString <wx_wxstring.html#wxstring>&
*/key/, const wxSize& size )
regards,
Klaas
--
Dipl.-Ing. Thomas Zehbe
INGENION GmbH
Kuhweide 6
31552 Apelern
Fon: 05043 / 40 57 90 4
Fax: 05043 / 40 57 90 7
> Am Mittwoch, 19. Juli 2006 22:23 schrieb Johan Vromans:
>> Thomas Zehbe <t...@ingenion.de> writes:
>> > wxString path = _T("/") + GetTitle();
>> > pConfig->Write(_T("x"), (long) x);
>>
>> I really wonder whether these strings should be i18n-ed.
> Because the Title is the human readable i18n-ed title of the frame and I use
> to code every literal string as _T() or _() except database columns and
> things like that.
I think your "/", "x" and "y" fall in the exception category as well.
-- Johan