Page 1 of 1

Different between wxMSW242 and wxGTK242?

Posted: Tue Dec 14, 2004 3:55 am
by Sirius
Recently I tried to compile a program in Linux enviroment-wxGTK 242, which I created with ans tested with wxMSW 2.4.2. I found that there are some different between these 2 Port:



My code:

Code: Select all

ShowErr(wxString("Price or Deposit is invalid"));
...
...

void myDialog::ShowErr(wxString& strErr) {
    wxMessageDialog dlgMsg(this, strErr, "caption",  wxOK|wxICON_EXCLAMATION);
    dlgMsg.ShowModal();
}

Under wxMSW, it can compile without any error reported. But in wxGTK, it
complaint that is an error at this line of code:

Code: Select all

ShowErr(wxString("Price or Deposit is invalid"));
So I got to change my code to this:

Code: Select all

wxString strErr;
strErr = "Price or Deposit is invalid";
ShowErr(strErr);

Is this a normal case? Which one is correct?


Thanks
--------
Sirius


wxMSW 2.4.2
WinXP, VC++ 6.0

wxGTK 2.4.2
Debian, gcc 3.3.3

Posted: Tue Dec 14, 2004 8:07 am
by upCASE
Hi!
Try again with using ShowErr(wxT("Price or Deposit is invalid"));, maybe that'll work.
Is this a normal case? Which one is correct?
Both are correct and can be used. gcc is slightly( :D ) more strit about standards than VC++ is.

Posted: Tue Dec 14, 2004 9:45 pm
by eco
If you are using the GTK2 version it uses Unicode so you'll need to surround all of your string literals as Sirius has shown.

Posted: Wed Dec 29, 2004 2:53 pm
by Sirius

Code: Select all

void myDialog::ShowErr(const wxString& strErr);
I add a 'const' for the member method, and everything is fine now :)

Thank you

Posted: Wed Jan 05, 2005 12:06 pm
by leio
I'll just comment about wxGTK-2.4.2
I see you are using wxMSW-2.5.2 and wxGTK-2.4.2, I highly suggest using wxGTK-2.5.3 or newer due to very significant goodness in there compared to 2.4.2 including many bugfixes. I got tens of bugs fixed in my project that were wxGTK specific just by switching to 2.5.3 (CVS HEAD to be more exact, but at the time 2.5.3 was just about to come out).
2.5 series might not be API stable, especially for some new classes, but it is quite stable codewise. In case of wxGTK more stable than 2.4.2 in places.