If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
I have had problems returning a value of wxString and am wondering if there are known problems doing this, or perhaps I am not doing it correctly....In general, sometimes the value is blank even though it was set in the called routine. The following simple example is what I am talking about. There are two objects from two different classes...one calls the other, the called routine returns a string, and the value is displayed in a messagebox. Sometimes this contains a value and sometimes it is blank. First question is does this look right? Does the value go out of scope in the called routine before it is returned to the calling routine? If I am doing this wrong, could someone please provide sample code to show how I should be doing this? Thanks in advance...(btw, I am using V2.8.11 wxWidgets build)
I see nothing obviously wrong. Have you checked inside GetStringValue that the string is ok before returning it?
Then is this sample producing the error, or only some more complex code of yours? Because I assume that if you are using sprintf then you have some formatting to do, maybe there is a problem with the formatting
"Keyboard not detected. Press F1 to continue"
-- Windows
I have checked from the called routine and there was a value in the wxString object before it returned to the calling routine. This sample code is not causing me a problem, I am just trying to simplify what my question is to ensure I am not doing anything obviously (to someone else) wrong. My actual code is more complex than this, but this is representative of what I am trying to do in that code.
I found a way around my problem, but not sure why my original code didn't work...
I was trying to build a new string using SetChar originally, but switched to Append.
Here is the routine and the offending statement is now commented out.