Re: Live byte count possible whilst *in* a field?
- From: "Christoph Bouthillier" <post@xxxxxxxxxxxxxx>
- Date: Mon, 3 Dec 2007 23:44:20 +0100
"Martin Trautmann" <t-use@xxxxxxx> schreef in bericht
news:slrnfl8fe7.ni.t-use@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mon, 3 Dec 2007 18:18:48 +0100, Christoph Bouthillier wrote:
Dear Listeners:
Is it possible in FMP 6 and/or 9 to have a live byte counter?
When composing an SMS/text message in a field with its max. 160 bytes it
would be nice to have a live counter besides the field, instead of
having to
click various times outside the field to check how far one has
progressed.
Any chance to realize this in FMP?
I built an SMS sending app (works just fine, via simple http requests at
www.world-text.com), and this would make it work the same way as e.g.
web-based SMS services where you can see the countdown running as you
type.
You can run a background task which would check the file size every
second (or even faster) and then select the field again. This will take
much of your cpu, feeling a little bit clumsy. Even worse, you may loose
the capability to position the cursor within text (FMP 6).
Try it yourself. Build a script
loop
set field (length) to length of SMS
goto field SMS /* position cursor if possible */
pause 1 second /* shorter if possible */
exit loop if current field is not SMS /* or other conditions apply */
end loop
Hello Martin:
Thanks for the help. I had to tinker with the script a bit and got it
running generally in FMP9 (haven't tried v6 yet). I did the following:
If [length(t.sms.text) >=160]
Go to field [(t.sms.text)]
Halt Script
Else
Loop
Exit Loop if [length(t.sms.text) >=160]
Go to field [(t.sms.text)]
Pause/Resume script [(Duration (seconds): 0,1]
Go to field []
End loop
End If
I made the menu bars and the status bar invisible - they would
otherwise flicker as mad.
I then added a calc field that says "Stop input with Escape key" as long as
the
bytecount is <160 and "The message is too long" as long as the bytecount
160. Without the Esc key the user cannot get out of the loop if he wantsto write a message with less than 160 bytes. This can also be achieved with
a button that does "Halt script".
I tried shorter pauses, too, but that did not help/was not necessary.
The first part of the script is necessary for cases when the user had
entered more than 160 bytes (this is (and must be for editing reasons)
possible after the loop has been left) and needs to edit the message and to
shorten it.
The button for the script should logically be assigned to the text message
field itself.
As soon as the 160 bytes have been reached, the script has ended but the
cursor remains in the field and the user can edit
the message freely at that moment.
There are however some glitches I could not overcome: spaces entered in the
SMS text field do not raise the byte count, even not under Unicode. And once
the user has left the field but wants to enter it again to edit it, the
cursor jumps always to the end, it's therefore impossible to edit
somewhere in the middle of the text. I believe I give up... anyway, it was a
nice try/exercise and thanks again for the input.
--
Met vriendelijke groet / Mit freundlichen Gruessen / With kind regards
Christoph Bouthillier
p o s t <<a t>> oh-no-spam t e k s t o t a a l << d o t >> c o m
Forget the oh-no-spam
.
- References:
- Live byte count possible whilst *in* a field?
- From: Christoph Bouthillier
- Live byte count possible whilst *in* a field?
- Prev by Date: Re: FM Pro 6: lost many records.
- Next by Date: Help --SEND MAIL script
- Previous by thread: Re: Live byte count possible whilst *in* a field?
- Next by thread: Create new record in SQL
- Index(es):