why doesnt Wxwidgets work with data types like Ms .net ? Topic is solved
-
- Earned some good credits
- Posts: 120
- Joined: Sun Sep 21, 2008 7:23 am
- Location: Somwhere nearby...
- Contact:
why doesnt Wxwidgets work with data types like Ms .net ?
i have a question , why doesnt wxwidgets work like Microsoft .net Framework on data types like string ?.
i mean Microsoft .net framework lets you use your conventional data types ( for example string in c++/C#) and then when compiling it converts it to its .net framework type !
the same thing can be done to wxwidgets specific data types like wxString ,
why doesnt wxwidgets do this job?
this will save us from alot of trouble for converting between wxwdigets wxstring and other equivalent types, and we can easily continue to code in our conventional way .and also will bring a more consistent look to our source code .
Regards
Hossein
i mean Microsoft .net framework lets you use your conventional data types ( for example string in c++/C#) and then when compiling it converts it to its .net framework type !
the same thing can be done to wxwidgets specific data types like wxString ,
why doesnt wxwidgets do this job?
this will save us from alot of trouble for converting between wxwdigets wxstring and other equivalent types, and we can easily continue to code in our conventional way .and also will bring a more consistent look to our source code .
Regards
Hossein
Add-on Components (90)
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/
Hi,
(I deleted your duplicate post.)
You can, of course, already convert between e.g. std::string and wxString. However wxWidgets tries to manage both ansi and unicode builds with the same code. This currently is done using the wxT() macro; starting from wx2.9 it happens invisibly: see http://docs.wxwidgets.org/trunk/overview_unicode.html.
Regards,
David
(I deleted your duplicate post.)
You can, of course, already convert between e.g. std::string and wxString. However wxWidgets tries to manage both ansi and unicode builds with the same code. This currently is done using the wxT() macro; starting from wx2.9 it happens invisibly: see http://docs.wxwidgets.org/trunk/overview_unicode.html.
Regards,
David
Also, with wx 2.8 (and before, I use this since 2.5) you can use wxUSE_STL (or something like that) in your Setup.h.
WX then derives wxString from std::string. Wich means, in this case, wxString IS a std::string. I use this for years now wihtout any trouble. In my Code I use std::string only. When calling wx methods I can use std::string. When getting a string from wx, I use std::string.
I can use std::string and wxString as if they were the same, so I never use wxString at all.
Works just fine
WX then derives wxString from std::string. Wich means, in this case, wxString IS a std::string. I use this for years now wihtout any trouble. In my Code I use std::string only. When calling wx methods I can use std::string. When getting a string from wx, I use std::string.
I can use std::string and wxString as if they were the same, so I never use wxString at all.
Code: Select all
std::string value = myTextCtrl->GetValue();
myTextCtrl->SetValue(value.substr(0, 5));
-
- Earned some good credits
- Posts: 120
- Joined: Sun Sep 21, 2008 7:23 am
- Location: Somwhere nearby...
- Contact:
so beginning form wxWidgets 2.9.X we can have such a thing huh?DavidHart wrote:Hi,
(I deleted your duplicate post.)
You can, of course, already convert between e.g. std::string and wxString. However wxWidgets tries to manage both ansi and unicode builds with the same code. This currently is done using the wxT() macro; starting from wx2.9 it happens invisibly: see http://docs.wxwidgets.org/trunk/overview_unicode.html.
Regards,
David
thats Great .
[and by the way sorry for duplication, that happened because of my low speed internet connection, sorry about that]
and about the link you posted , it said
'Documentation Not Found'
Add-on Components (90)
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/
-
- Earned some good credits
- Posts: 120
- Joined: Sun Sep 21, 2008 7:23 am
- Location: Somwhere nearby...
- Contact:
its just Great, i would be grateful if you guide me how to do t hat ?Frank wrote:Also, with wx 2.8 (and before, I use this since 2.5) you can use wxUSE_STL (or something like that) in your Setup.h.
WX then derives wxString from std::string. Wich means, in this case, wxString IS a std::string. I use this for years now wihtout any trouble. In my Code I use std::string only. When calling wx methods I can use std::string. When getting a string from wx, I use std::string.
I can use std::string and wxString as if they were the same, so I never use wxString at all.
Works just fineCode: Select all
std::string value = myTextCtrl->GetValue(); myTextCtrl->SetValue(value.substr(0, 5));
which setup.h and where? would you post an tutorial on this ?
Add-on Components (90)
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/
Where to find your setup.h depends on your Plattform. My is here: include/wx/msw/setup.h
It's all documented direcly in that file. The lines you have to change are wxUSE_STD_STRING and (don't know if this is even neccesary for std::string to work, I have my set to 1 because it's 2009 and not 1995) wxUSE_STL. If you wan't to use STL instead of crappy markos for List, Vector, you definiteley should set this.
It's all documented direcly in that file. The lines you have to change are wxUSE_STD_STRING and (don't know if this is even neccesary for std::string to work, I have my set to 1 because it's 2009 and not 1995) wxUSE_STL. If you wan't to use STL instead of crappy markos for List, Vector, you definiteley should set this.
Hi!
Just an addon comment: For Linux you don't have to modify setup.h yourself. The configure script has an option you may enable and the correct values will be set in setup.h.
Just an addon comment: For Linux you don't have to modify setup.h yourself. The configure script has an option you may enable and the correct values will be set in setup.h.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
-
- Earned some good credits
- Posts: 120
- Joined: Sun Sep 21, 2008 7:23 am
- Location: Somwhere nearby...
- Contact:
thank you guys .
and the WXUSE_STD_STRING stuff .
i found
so you mean i should change " #define wxUSE_STD_STRING 0" to #define wxUSE_STD_STRING 1 ?
and i changed
#define wxUSE_STL 0
to #define wxUSE_STL 1
i just need confirmation for the first one !
and the WXUSE_STD_STRING stuff .
i found
Code: Select all
#if defined(__DMC__) || defined(__WATCOMC__) \
|| (defined(_MSC_VER) && _MSC_VER < 1200)
#define wxUSE_STD_STRING 0
#else
#define wxUSE_STD_STRING 1
#endif
and i changed
#define wxUSE_STL 0
to #define wxUSE_STL 1
i just need confirmation for the first one !
Add-on Components (90)
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)
http://www.wxcommunity.com/