Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
KeyPress and the Tab Key
Message
 
To
03/12/2002 20:41:23
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00729134
Message ID:
00729401
Views:
12
>>---------------------------------------
>>I have an editbox in which the users are used to using the tab key and in days long gone (at least for now), that tab key would actually insert tabs (go figure)
>>
>>Now because as we take the reports entered in these editboxes, and move them to the web...and the web side had great difficulty with the tabs in the text (different expression of how wide a tab is
>>and perhaps a different understanding of tab-stops),
>>my editboxes now give me 3 blank spaces instead of tabs, and my tab-stops have become a thing of the past...at least for now....
>>Now when the user hits the tab key I drop in 3 spaces instead.
>>
>>I'm not sure if I'm doing this right and would like your advise.
>>Now I'm trapping the tab key, by using the editbox KeyPress Event.
>>I think I'm doing it wrong tho....
>>Right now I'm doing a
>>KEYBOARD '{BACKSPACE}' && remove the tab just typed
>>KEYBOARD ' ' && replace it with 3 spaces
>
>Given the constraints you're facing, you're maybe doing the best you can. The only enhancement I'd make would be to replace the backspace with a simple NODEFAULT, so the tab key never happened, and then insert the three spaces as you did.
>
>>I'm still having text formatting issues, but now they're on my side not the WEB side. Sometimes the text, separated by tab key inserted spaces, does not remain in it's place, after being saved into the memo field associated with the editbox.
>>
>>Any ideas?
>>How would you do this tab replacement?
>>(changing the web side to handle tabs is out for now)
>
>How about having two memos - one for your own use (with tabs) and another for the web app (adjusted for the display there)? I know this solution is a big kludge, but if you have only one memo...
>
>>BTW - any idea as to how I can simulate the TAB STOP behavior?
>
>Depends on where you need it. If you need to show the tabs in editbox only, you can internally replace tabs as any special expression you like, and in editbox.gotfocus strtran() the tabs back into place, in .lostfocus() replace them with that arbitrary expression. And when the web app uses the data, it would have to StrTran() the expression to spaces. Or, with the two memos (as above), you'd have it both ways, with the additional hassle of maintaining the content in two places.
---------------------------------------
NODEFAULT .... Now there's an idea...why didn't I think of that??? Thank you.

2 memos:
.. one with tabs,
.. one with spaces... that could work, if I could figure out the column (aka - how many blank spaces to insert for the current tab character)
If I can figure that out then that takes care of the tab stop question as well.
Sometimes the first tab (on each line) will move the cursor over 3 characters, 2 characters, and Sometimes 1 character, depending on it's starting position.
As a result I can't just do a STRTRAN( cMyText, CHR(9), SPACE(4))

Any ideas how to approach this?
---------------------------------------
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform