AI2 - add tab in between 2 text (while creating a tab delimited text file)

431 views
Skip to first unread message

SS TheAppInventor

unread,
Dec 16, 2016, 8:11:37 PM12/16/16
to mitappinv...@googlegroups.com
Hi all, Iam working on an app that writes 2 fields in a text file: eg
Barcode  Qty
"34234242342" "100"
"786786786786" "500"
"888578867867" "1000"

I need a tab in between barcode and qty so that file I am exporting can be used on a windows app.

I have already tried 5 and 8 blank spaces and used \n but not getting any resolution.

Any help will be greatly appreciated and thanks in advance!

SS
Message has been deleted

Evan Patton

unread,
Dec 16, 2016, 10:49:46 PM12/16/16
to MIT App Inventor Forum

Actually it is possible but it cannot be done just with App Inventor. The problem is that typically the tab key has a special meaning on web pages, which is to go to the next focusable element, so when you attempt to type a tab into a text box, for example, it will focus on some other element. This behavior is not triggered if you paste the tab character from another program. It's possible to copy a tab character from your favorite text program (I used TextEdit.app on Mac) and paste it into a text field in App Inventor. I've attached the screenshot of the blocks I used and tested against three things: Label, Notifier, and File. Each seemed to show a wider than normal whitespace where the tab character is located. The text file contains ASCII value 9 (horizontal tab) at byte 4, so it's definitely ending up in the companion app. I did not test compiling the app, so it's possible there is differing behavior, but I think it is unlikely. Let us know if that works out for you.

Evan

SS TheAppInventor

unread,
Dec 17, 2016, 7:47:38 AM12/17/16
to MIT App Inventor Forum
Thanks Evan. You are a genius!!!. That was last puzzle in my app and your solution worked.

Kind regards,
SS

Abraham Getzler

unread,
Dec 17, 2016, 8:52:45 PM12/17/16
to MIT App Inventor Forum
See attached for how to get a TAB character using the Web component and a html stunt.
From my CRLF app in the Gallery.
ABG

TAB.png
Reply all
Reply to author
Forward
0 new messages