Display answer in field rather than popup?

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
ukaussie
Posts: 23
Joined: Mon Sep 28, 2009 9:04 pm

Display answer in field rather than popup?

Post by ukaussie » Mon Sep 28, 2009 9:35 pm

I'm a newby so here goes...

I have created an application with four sliders. The value from each slider gets put into its own global variable. I then have a button where the four variables are entered into a formula. When you click the button the answer is displayed in a pop up window.

However, what i want to do is display the answer within a box (a field) already visible on the card. The code associated with the button is:

Code: Select all

global tfSessionDuration, tfMeanHR, tfRestingHR, tfMaximalHR

on mouseUp
   answer "The TRIMP for your training session is " & round(tfSessionDuration * ((tfMeanHR - tfRestingHR)/(tfMaximalHR - tfRestingHR)) * ((2.71200^(((tfMeanHR - tfRestingHR)/(tfMaximalHR - tfRestingHR)) * 1.67)) * 0.86),0) & " arbitrary units"
end mouseUp
How might i change this so that it displays within a box (a field) within the card, rather than in a popup window?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Post by bn » Mon Sep 28, 2009 11:09 pm

Hi ukaussie,

Welcome to the forum.

instead of
global tfSessionDuration, tfMeanHR, tfRestingHR, tfMaximalHR

on mouseUp
answer "The TRIMP for your training session is " & round(tfSessionDuration * ((tfMeanHR - tfRestingHR)/(tfMaximalHR - tfRestingHR)) * ((2.71200^(((tfMeanHR - tfRestingHR)/(tfMaximalHR - tfRestingHR)) * 1.67)) * 0.86),0) & " arbitrary units"
end mouseUp
put

Code: Select all

global tfSessionDuration, tfMeanHR, tfRestingHR, tfMaximalHR 
on mouseUp 
   put "The TRIMP for your training session is " & round(tfSessionDuration * ((tfMeanHR - tfRestingHR)/(tfMaximalHR - tfRestingHR)) * ((2.71200^(((tfMeanHR - tfRestingHR)/(tfMaximalHR - tfRestingHR)) * 1.67)) * 0.86),0) & " arbitrary units" into field "myFieldName"
end mouseUp
as easy as that, you just provide the field, give it a name and adjust the code to the name of that field.

regards
Bernd

ukaussie
Posts: 23
Joined: Mon Sep 28, 2009 9:04 pm

Problem solved!

Post by ukaussie » Tue Sep 29, 2009 12:53 am

Hi Bernd,

That's great...it worked! So simple! Thanks for your help.

Cheers,

Grant.

Post Reply