2 replies [Last post]
Last seen: 16 years 32 weeks ago
Joined: 2004-10-05
Posts: 1
Points: 0

I'm designing a text display system for a kiosk that'll use a touch screen. I just want to display information, nothing fancy.

The text will orgininate from a SQL database. The most user-friendly design I can would be one where a complete page of text was displayed at once, and there were buttons on the bottom to advance or go back, for instance:

The text portions could very easily go four or five pages, but in the database they're saved as one long entry.

I'm trying to work out a method to get as much text into each page's box without going over, having text hidden or wasting space. The trouble I'm having is working out a way to compensate for the word-wrapping -- a few long words at the wrong spots and I'm in trouble.

I'm tempted to use a Perl script to pull the data and then generate all the relevant pages at once, adding each word individually then checking for additional space.

This seems like an extremely ugly way to do it and I don't like it a bit; does anyone have a recommendation? Maybe a way to load it all into memory at once and have the advance/backup draw directly from that while leaving the rest of the page alone?

Tony's picture
Last seen: 1 week 6 days ago
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Text box tricks

Hi Skyshadow,
You would have to set a div with overflow set to hidden.
Then inside that div have another that contains the content and is absolutely positioned.
You would then need to use JavaScript to move the content div up or down.

Hope that helps

roytheboy's picture
North Wales, UK
Last seen: 7 years 42 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

Text box tricks

skyshadow - you're asking a lot to do what you're suggesting, and AFAIC, server-side scripting is the only way to do it cleanly. Tony's idea is very clever, but you'll end up with screens of half-started, half-finished sentences (which might be fine for what you want).

To do this cleanly, you'll need to pull the data using perl or php (either would do), count the characters in each word, calculate the line breaks mathematically, then take into consideration full stops followed by spaces so that you end up with complete sentences on each screen. Even then it's not fool-proof due to differing character widths, although you could build in an allowance for that. Mathematically it sounds pretty complex to me, but I for one don't know of a better way to achieve what I think you want. I'd be interested to know if there is an existing php module or class with this sort of functionality - have you looked?

Life's a b*tch and then you die!