G3 Button Text not displaying long text string.
billyung
Posts: 16
I'm using a CV10 panel and sending about 100 character text string to a certain button. The problem is twofold. Firstly, I cannot get more than about 50 characters to display. Doesn't matter whether I break the string up and concatenate it together in the send_command with carraige returns or not. Is there a limitation on button text that isn't documented? Secondly, it doesn't appear G3 has any text wrap attribute for button text. Is there an easy way to do text wrapping or am I going to have to code the text wrapping routine by hand?
Thanks,
Bill
Thanks,
Bill
0
Comments
But you are definitely on your own with word-wrap in a G3 panel. You can imbed a | character to force a line feed, but you will have to calculate ourself where to insert them.
I wrote my own weather module (it uses NOAA's free telnet to get its info) before AMX came out with the i!-Weather and I wanted to be able to print out the entire 7-day forcast. It was commonly over 255 chars. I too couldn't find any docs on the limit of chars that could be sent.
My first fix was to simply trim down to a 3-day forcast. However, the lameness of that soon caused me to loose sleep. so my next fix was to create a crawling text display. So the text would crawl across the screen like one of those LED displays you see in banks and schools and whatnot to display messages.
That's how I dealt with it.
I suppose a person could mess with having two text buttons abutted together and deal with it that way.
Your problem of only seeing 50 chars seems to be more of a programming issue. The text may indeed be getting to the panel alright but you're comment about not having a 'text wraping' function is probably dead on. with G3 panels you probably have to do the text wrap yourself in programming.
You could create a little routine that would insert a pipe '|' (Shift-Forward Slash) every 50 chars or so. that forces a carriage return in the button text window.
example:
text =" ' bla bla bla for 50 chars',$7C,'more stuff bla bla for 50 more chars',$7C,'bla bla' etc... The $7C is the hex ascii for a 'pipe'
I do it with a for loop with 'X' equalling the length of the original string.
Hope that helps
Dave,
You are on the right track. The limitation is the payload of the SEND_COMMAND after the device name including the command itself. I believe it is about 64 charaters. This has to do with the limitations of the Axlink bus. Any message to a device on Axlink can not exceed a maximum number of bytes. This format would give you a maximum of 60 charaters for the text.
I concur with Brian, my understanding is that a send_command is limited to 64 characters.
However I also have in a dusty corner of my mind another factoid - that there is a limit of 128 characters on AXLink communications. Not sure if that has any bearing on this!
When I asked in a different thread how to present on a G3 touchpanel lots of text which changes from time to time, the best response I got was to ftp it across as a bitmap. I can't imagine how you would do that from NetLinx code however!
Eric, how did you do the crawling text display?
Thanks for all the help. The answer I needed was the 64 character limit on the send command. My text wrapping code ended up looking like this:
integer mypos
integer lastpos
char longsourcestring
char deststring1 [60]
char deststring2 [60]
char deststring3 [60]
char deststring4 [60]
mypos = find_string(longsourcestring, ' ', 46)
if(mypos==0)mypos=256 //in case this is the last line.
destring1 = left(longsourcestring, mypos-lastpos)
lastpos=mypos
lastpos=mypos
mypos = find_string(longsourcestring, ' ',(lastpos+50))
if(mypos==0)
deststring2 = right_string(longsourcestring,(length_array(longsourcestring)-lastpos))
else
deststring2 = mid_string(longsourcestring, lastpos, mypos-lastpos)
lather... rinse ... repeat.
It works fine this way. I suppose if you have a really long word in just the right place, it might cutoff. This could be fixed if there were a way to search a string from the end toward the beginning for a space. I don't care though. It's plenty good enough now. I'm using this to display movie plot summaries from an older MAX unit. Quite happy to have the new feature without the $30k upgrade.
Thanks again for all your help,
Bill
I tell the theory. The programming after that is not so bad.
Let suppose you have a string that's 79 chars long.
original_text='Now is the time for all good men to come to the aid of their country.'
Set up a for loop that builds a temp string that is compsed of chars 1+X thru 30+X where X is an offset.
// the following builds the little 30 char chunk for you.
For(crawl_text_x=1;crawl_text_x<31;crawl_text_x++)
{
temp_text="temp_text,origianl_text[crawl_text_x+offset]"
}
(You can also get this done by using LEFT_STRING / RIGHT_STRING to isolate the 30 char chunk. I use the for loop as it allows me to stick in little conditionals like "remove any <CR's> or add spaces at the end of the string, etc....)
... after loop send the string
first run: offset=0 text = "Now is the time for all good m"
next step after the desired wait time is increment offset. I did it 3 chars at a time.
Next step offset=3
So the next temp text is " is the time for all good men "
send string to the panel.
Next Step offseet = 6
So the next temp text is " the time for all good men to "
send string to the panel.
Repeat and account for the text wrap around. I put in 15 spaces at the end of my whole text to give the crawl a bit of space at the end.
by lowering or raising the offset you speed up or slow down the crawler.
Also, by lowering or raising the wait time between send_strings gets it done. I found that G3 panels don't handle times much under 10 - 20 ticks.
You can trigger the event from a timeline or do it the old fashioned way.
Hope that helps.
ejm
What is the address for the free weather data login?
Thanks!
I thought you had something magical - it turns out to be just good ole coding!
Having said that, the idea of sending changing text to a button is new, if obvious, to me.
Thanks.
66.28.69.161 port 23
This is The Nation Weather Underground telnet site. It farms data from the NOAA feed and is updated every minute.
However, I've found that you only need to update every 20 minutes or so since NOAA updates about that often.
I'd operate it in Hyper terminal first to see how it works.
It's pretty straight-forward.
Hope that helps
ejm
Magical? I'm afraid not...
I'm pretty old-skool when it comes to things like that.