changing answer style

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

changing answer style

Post by greggarcia » Wed Dec 09, 2009 2:42 am

Sorry fo to many doubt about using Revtalk but has been two weeks learning the basic, but i was unable to find an answer for this:
i want to know if it is possible change the text style when we use answer command? for example i want to show to the user:
answer "Hello" && field "fname" && "the right answer is..." && tresult
where field "fname" is the name of the user who has been login at the beginning
tresult is the temporary variable that i used to keep some data.

So how can i change the text style of "fname" in the answer dialog? i would like to put emphasis in the "fname"

thanks so much
greg

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: changing answer style

Post by sturgis » Wed Dec 09, 2009 2:53 am

You can specify html tags in your prompt string to accentuate the parts you want.

From the dictionary
Comments:
The prompt can be either formatted text (in the htmlText property's format) or plain text. If the prompt contains <p> or a start/end tag pair, the answer command assumes the text is in the same format as the htmlText property. Otherwise, the answer command assumes the text is plain text.
So

Code: Select all

answer "<B>This is Bold</b> <i>This is italic</i>"
Will show an answer dialog with This is Bold This is Italic

greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

Re: changing answer style

Post by greggarcia » Wed Dec 09, 2009 3:29 am

Sturgis, thanks i am tried but it works fine with text not for field inside de answer, i put like this answer "hello" && "<b> field "fname" </b>" and i got an error i tried several form and just instead put the user name it put like a text field fname in bold. Where is my mistake?

thanks again
greg

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: changing answer style

Post by sturgis » Wed Dec 09, 2009 3:38 am

The tags have to be within quotes.

answer "some text here <b>" && field "the field" && "</b>"

greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

Re: changing answer style

Post by greggarcia » Wed Dec 09, 2009 4:54 pm

Sturgis you are the man, now is working i just put like this
answer "Hola" && "<b>" && field "fNombre2" && "</b>" && "el resultado es...." && tResult titled "Y la respuesta es........"

i now i will play around with other text style, i am not a contributor now in this forum but give another couple months and you wil see, :D


thanks a lot
greetings
Greg

greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

Re: changing answer style

Post by greggarcia » Wed Dec 09, 2009 7:51 pm

wow now i am available to change size, color, font, etc using structure as html.
thanks Sturgis

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: changing answer style

Post by sturgis » Wed Dec 09, 2009 7:57 pm

Glad to help. :)

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: changing answer style

Post by Mark » Wed Dec 09, 2009 9:08 pm

Hi,

Just to be on the safe side, you might want to start your answer text with <p> and finish it with </p> to make sure that the scripts in the answer dialog recognise your text as html code.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

greggarcia
Posts: 33
Joined: Mon Apr 27, 2009 3:32 pm
Contact:

Re: changing answer style

Post by greggarcia » Wed Dec 09, 2009 11:50 pm

Thanks Mark i will do it.

Post Reply