Use of ASCII seperators for Windows 98 systems
-
Hi guys, I'm looking for some ASCII characters that can be used as some sort of separator delimiters. For example, I have few string fields I'd concatenate into one long string and put into CListBox. Then I'd need to be able to retrieve the string and break them up back to original fields. So ideally, those separators should be invisible on the display.
(S)Hi, The(E)(S) Code (E)(S)Project is Cool!(E)
would display as
Hi, The Code project is Cool!
where (S) is invisible start delimiter and (E) is the end delimiter. I tried "Unit Separator" and "Record Separator" (0x1F and 0x1E respectively), they work fine in Windows XP, where these are not displayed. However, when I moved the app to Windows 98, they are shown visibly as rectangle blocks. I'm wondering if the difference is due to the uses of unicode and not. If so, are there any ASCII I can use for my purpose? Thanks alot!
-
Hi guys, I'm looking for some ASCII characters that can be used as some sort of separator delimiters. For example, I have few string fields I'd concatenate into one long string and put into CListBox. Then I'd need to be able to retrieve the string and break them up back to original fields. So ideally, those separators should be invisible on the display.
(S)Hi, The(E)(S) Code (E)(S)Project is Cool!(E)
would display as
Hi, The Code project is Cool!
where (S) is invisible start delimiter and (E) is the end delimiter. I tried "Unit Separator" and "Record Separator" (0x1F and 0x1E respectively), they work fine in Windows XP, where these are not displayed. However, when I moved the app to Windows 98, they are shown visibly as rectangle blocks. I'm wondering if the difference is due to the uses of unicode and not. If so, are there any ASCII I can use for my purpose? Thanks alot!
There are no characters you can use for non-UNICODE, the ANSI-fonts are supposed to show a "dummy"-character for codes they don't define. So, yes, you are right, this is a question of UNICODE and non-UNICODE :-) What I would have done would be to create an owner-drawn listbox (which is not at all difficult once you've done it once or twice, if you hesitate). There, I would have split the strings according to some of me defined delimiter.
-
There are no characters you can use for non-UNICODE, the ANSI-fonts are supposed to show a "dummy"-character for codes they don't define. So, yes, you are right, this is a question of UNICODE and non-UNICODE :-) What I would have done would be to create an owner-drawn listbox (which is not at all difficult once you've done it once or twice, if you hesitate). There, I would have split the strings according to some of me defined delimiter.
Thanks alot Johan, I'm trying to think very hard to how Owner Draw on CListCtrl (it's actually CCtrlList I'm using) can help me. But you were right. Since I haven't done this before, I have trouble to figure out a way. I'd really appreciate some hints here :) Do you mean that I could somehow display the string and "hide" those delimiters? My understanding to Owner Draw is being able to draw images and customise text. I don't really know how it can help in my case. Thanks again
-
Thanks alot Johan, I'm trying to think very hard to how Owner Draw on CListCtrl (it's actually CCtrlList I'm using) can help me. But you were right. Since I haven't done this before, I have trouble to figure out a way. I'd really appreciate some hints here :) Do you mean that I could somehow display the string and "hide" those delimiters? My understanding to Owner Draw is being able to draw images and customise text. I don't really know how it can help in my case. Thanks again
Consider a listbox containing the string
Alpha|beta
In a draw handler, we get the string, and want to use the bar as a delimiter.
// str contains the current line we are drawing
CString left;
CString right;
int found = str.Find( _TCHAR( "|" );
if( found != -1 )
{
left = str.Left( find );
right = str.Right( str.GetLength() - ( found + 1 ) );// Now we can draw left and right to screen, delimited
// a line or another character or just some spacingdc->TextOut( left, ... // will contain "Alpha"
dc->TextOut( right, ... // will contain "Beta"}
You might want to check the articles in http://www.codeproject.com/listctrl/[^], I notice that the very first one discusses owner-drawing.
-
Consider a listbox containing the string
Alpha|beta
In a draw handler, we get the string, and want to use the bar as a delimiter.
// str contains the current line we are drawing
CString left;
CString right;
int found = str.Find( _TCHAR( "|" );
if( found != -1 )
{
left = str.Left( find );
right = str.Right( str.GetLength() - ( found + 1 ) );// Now we can draw left and right to screen, delimited
// a line or another character or just some spacingdc->TextOut( left, ... // will contain "Alpha"
dc->TextOut( right, ... // will contain "Beta"}
You might want to check the articles in http://www.codeproject.com/listctrl/[^], I notice that the very first one discusses owner-drawing.
Thanks again, Johan, As I understand, it is to use the Owner Draw to customise the display of the text on list box. In your example, the text Alpha|beta can get shown as Alpha beta. And so supposedly, when I retrieve the text from the list box using
GetText()
, it should still return Alpha|beta? The actual content is not changed, just displayed differently on screen? Is it how this works? Thanks. -
Thanks again, Johan, As I understand, it is to use the Owner Draw to customise the display of the text on list box. In your example, the text Alpha|beta can get shown as Alpha beta. And so supposedly, when I retrieve the text from the list box using
GetText()
, it should still return Alpha|beta? The actual content is not changed, just displayed differently on screen? Is it how this works? Thanks.Exactly!