Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display & edit DOS chars in editbox
Message
 
To
18/01/2007 09:53:58
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 2000 SP4
Miscellaneous
Thread ID:
01186616
Message ID:
01186756
Views:
19
Hi Peter,

>Q: Is there a font that will display both the Dos and Windows charset correctly?

That really depends on what is correct. The problem with DOS and Windows application is a code page issue, not a font problem. There are two aspects to that:

1) Visual FoxPro automatically performs code page conversions when accessing a table. If the table has got the same code page as the system or the table doesn't have a code page flag, then Visual FoxPro performs no conversion. In any other case, VFP converts data to the current code page when reading from a table and back when writing into the table. CPDBF() returns the code page for a table.

Reading and writing might cause data loss when there are characters that do not have a corresponding character in the other code page. In this case, Visual FoxPro replaces the character with one that looks similar. For instance, the graphical cross in DOS applications is replaced with "+" when you read from the table. Because "+" is available in Windows and DOS, VFP keeps this character when it writes the value back into the table. As a result the DOS cross is gone.

2) A font maps a character of the current system code page to a visual representation. FoxFont is a little bit different. It's designed so that it assumes the current code page is a DOS code page. The result is that unconverted DOS text displays properly. However, keyboard input is based on the system code page which is usually Windows. If you enter something into a textbox that is formatted with FoxFont, the character you typed is not the character that is displayed except for the first 127 characters in the code page that are the same for DOS and Windows.

If these tables contain just text it would be the easiest solution to set the code page in the table. I'm not sure, if clipper tables do support this feature, though. FoxPro and FoxBase tables do.

If that's not an option, you can use CPCONVERT() to convert data when you read them from a table and back when you write data.

To just display information, you can use FoxFont. However, if you have any Windows data in the application such as code you edited in the code editor, you need to convert this text to DOS using CPCONVERT() before you can display it.
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform