Using Button for Chat_Labels

!
Test_Height_copy (1).aia (5.2 KB)
I have a two column Chat/message app using buttons left and right. This test does not regularly display the Button1 height correctly. I've also tried this with label and text boxes. Where did I go wrong? Thanks, Charles

Replacing your Button1 with a Label seems to works OK, the label will "grow" to contain the text, a button will not.

image

If you want all the chat boxes to be the same size, regardless of the length of the message, then a bit more work is required

If that is not what is needed, explain further....

If you need the message to be clickable there is an extension for that:

TimAi2
Yes I want my chat boxes to be the same length, probably 60 or 70 percent of the Vertical Arrangement. What should I do? Thanks Charles

These blocks seem to do it. I set the vertical scrolling arrangement to 240 pixels. i do not believe this will work as well if using percentage heights.

However you will need to set a character limit of @ 150 characters (length of text) otherwise it will overflow the chat box. (you can use Taifun's textbox extension for this)

You may also want to see this:

https://ai2.metricrat.co.uk/guides/firebase-chat-label-html-content

and this

if you want to use AppInventor

Test_Height_0607.aia (5.8 KB)

TimAI2,
Thanks for your reply. I really prefer a rounded/colored button to the appearance of labels or text boxes. The attachment shows the Height component of button I used before that 'almost' looks OK. My approaches of vertical spacing between the left and right ( or To & From) buttons. My method uses guesses to compute heights... can you suggest a more scientific method? I've included the aia if you're interested in spacing. Thanks Charles

Hello Charles

One method to get the right height would be to first populate a Label with the message, get the Label height, apply it to the Button. Since they are not identical components, you may need to adjust the height by a factor that you will discover during your tests. A Label whose text colour is the same as the background can't be seen by the User.

Example (many ways to do this)

Snap1

Test_Height_0607 (1).aia (6.0 KB)

Thank you ChrisWard,
I'll check out you button/height suggestion next. In the meantime I found a method that seems to work... but crazy. To make it work correctly with the Attachment I must touch the Start button twice, or use a Clock, to run the procedure correctly. The aia demonstrates the buttons print well for 4 different messages. Again, I'll try to try your button approach. Thanks Charles

[Test_Height_0607 (1).aia|attachment(upload://ymTYcL9euOiWXHaUM5EImOTwO8P.aia) (6.0 KB)

ChrisWard,
My last Reply must have been misplaced. I mentioned my test version of this Button using Label which now works well using a Clock. Again, the purpose of this app was to create the computed label height using various message lengths and the use it in my Chat App. The above blocks from the test are now incorporated into Chat App. lblTemp.height does not react to lblTemp.text. Why does this code work with Test but not with the app? Any ideas and thanks Charles

  1. aia for Test
  2. Blocks put in Chat app

Hi Charles

  1. Your test project has not uploaded.
  2. To (potentially) get a faster reply, use the reply button at the bottom of a post - the poster then gets a notification that you have added a post to your Topic.
1 Like

Hi again

You have Procedures calling Procedures which is never a good idea and not necessary in this case. In fact, your code is too far removed from mine - it would be much easier to make a test Project with my code as the basis.

Hi ChrisWard

Maybe there are system problems. Campion's availability has been about 5% the last week, but was great yesterday and today. As far as you, or the notifier, being unable to receive my Replies - I have no idea. When I am about to send a message I take care to check your Reply button and then wait for your system to respond with an attachments, and the message. This is a concern.

Your Chat Label code emphasizes Buttons. My systems handles Buttons Ok. My concern is the Buttons height. I'm hoping to improve each height adjusted for message length. I'm hoping to use Label height... sometimes it works, but often 'height=0'!

I appreciate your concern. Thanks Charles

ChrisWard,
I'm primarily interested in my button's height. This attachment shows a portion of the first button of 10 in 2 procedures. Thanks again, Charles :wink:

Hi Charles, concerning the Companion, we had sever issues with the MIT Servers. Everything should be working now, though there may be some disruption in the near future as some major hardware will be replaced with new.

Concerning replying to a Topic:
Reply To Topic or Post

Note that Forum Members should only send Private messages to Power Users when invited to do so as (a) we are a small team collectively supporting thousands of Users and (b) the person messaged could be unavailable for days or weeks and the message left unread.

Concerning your Buttons - looks like a lot of code but I don't know exactly what your output looks like (or should look like) so I can't offer a better method.