![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
We have a Paradox database. It contains information about products we copy off the 'Net. We have a custom utility that cleans text in Windows clipboard of any forbidden characters like carriage return/line feeds (CRLF). I have told the employees time and again to NEVER paste text directly from a web page into a Paradox field. But they sometimes do and when the field contains a CRLF it signifies to Paradox that it is the end of the record when we export the data to a flat ASCII file. Any data after the CRLF is gone. Is there any mechanism in Paradox that will filter out forbidden characters so this no longer happens? |
#3
| |||
| |||
|
|
when the field contains a CRLF it signifies to Paradox that it is the end of the record when we export the data to a flat ASCII file. |
#4
| |||
| |||
|
|
On Thu, 28 Jun 2007 10:15:37 -0700, Ike wrote: 2. Write OPAL code that intercepts the ctrl-v, and instead of doing the default paste event, substitutes your own custom method. This method would paste the text into a string variable and then, perhaps, step through it looking for illegal characters. If you only want to scrub CR/LF, a breakApart will do it in a single whack. Personally, I step through the entire string and expunge *all* low and high ascii, including tabs (each of which gets replaced with three spaces). Jim Hargan |
#5
| |||
| |||
|
|
Better option, forget trapping paste and instead, use the changeValue event to look for and remove illegal characters - then, no matter how they got there, you remove them. I prefer this over doing it at export because then your database has good data, not just your export. Liz |
#6
| |||
| |||
|
|
They are all good ideas. My preferrence would be to strip the forbidden characters before they are accepted by Paradox. |
|
Though I have quite a bit of programming experience, mostly scripting, I have found OPAL to be quite obtuse. I would love to learn, but I have yet to find a book teaching the beginner how to program in OPAL. Suggestions? Thank you. |
#7
| |||
| |||
|
|
Ike wrote: They are all good ideas. My preferrence would be to strip the forbidden characters before they are accepted by Paradox. The changeValue event will do that, as long as you don't call doDefault first. Though I have quite a bit of programming experience, mostly scripting, I have found OPAL to be quite obtuse. I would love to learn, but I have yet to find a book teaching the beginner how to program in OPAL. Suggestions? Thank you. In the changeValue event: var stNewValue String arBreak Array[] String liCounter longInt stBadChars String endVar stBadChars = "\n\r\t" ;// line feed, carriage return, tab ;// add additional characters as desired stNewValue = string(eventInfo.newValue()) stNewValue.breakApart(arBreak,stBadChars) stNewValue = arBreak[1] if arBreak.size() > 1 then for liCounter from 2 to arBreak.size() stNewValue = stNewValue + " " + arBreak[liCounter] endFor endIf eventInfo.setNewValue(stNewValue) ...the End. Liz |
#8
| |||
| |||
|
| But, my problem is when I try to read the help tutorial, I can't even find WHERE to put your code, or if it gets attached to an object, etc. |
#9
| |||
| |||
|
|
Ike wrote: But, my problem is when I try to read the help tutorial, I can't even find WHERE to put your code, or if it gets attached to an object, etc. Go to Tools > Settings > Developer Preferences...; make sure the ObjectPAL level is set to Advanced and Show developer menus is checked. Now go into design mode on your form and select the field object (not the label, not the editRegion, but the field) and press Ctrl+Spacebar to open the Object Explorer. On the Events tab should be an event named changeValue. Open it up. Put my code between the pre-existing method..endMethod lines. Check syntax, edit as needed and run. |
#10
| |||
| |||
|
|
What I really need is a reference other than Paradox's help files. |
![]() |
| Thread Tools | |
| Display Modes | |
| |