Rev 2.6 Not LiveCode

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gray.nomad
Posts: 2
Joined: Mon Aug 01, 2011 12:29 am

Rev 2.6 Not LiveCode

Post by gray.nomad » Mon Aug 01, 2011 12:47 am

Hello Gurus,
I am by NO MEANS a programmer, but just would like some help with Rev 2.6, which is probably not dissimilar to Live Code.
I bought this Rev 2.6 some 5-6 years ago and was far to busy with my normal work. Now, that I have retired, I'd like to get
a bit deeper into it.
I want to develop a small application, in which a label (CalcField) needs to change backgroundColor according to the value it contains.
The value is determined by multiplication of 2 other fields .

I have not found out how to change the backgroundColor according to the changing value as per CalcField.
I would appreciate if one of you gurus could help me out.

Below is the working snippet bound to the calculation button.

on mouseUp
--multiply fld "injury * fld "Occur" and put result into fld CalcField
put fld "Injury" * fld "Occur" into tResult
put tResult into fld "CalcField"
--change backgroundColor of fld CalcField according to content.
--between 1-10, red; between 11-19 yellow; between 20-25 green.
end mouseUp

Thank you for your help.
Frank

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Contact:

Re: Rev 2.6 Not LiveCode

Post by splash21 » Mon Aug 01, 2011 1:07 am

Hi, Frank. I'm assuming the language basics haven't changed from 2.6, so the following should work after you put tResult into CalcField;

Code: Select all

   if tResult >= 1 and tResult <= 10 then
      set the backColor of fld "CalcField" to red
   else if tResult >= 11 and tResult <= 19 then
      set the backColor of fld "CalcField" to yellow
   else if tResult >= 20 and tResult <= 25 then
      set the backColor of fld "CalcField" to green
   else
      set the backColor of fld "CalcField" to white
   end if

J

(P.S. if CalcField is a label, make sure it's opaque property is true!)
LiveCode Development & Training : http://splash21.com

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Rev 2.6 Not LiveCode

Post by shaosean » Mon Aug 01, 2011 1:09 am

Code: Select all

on mouseUp 
  --multiply fld "injury * fld "Occur" and put result into fld CalcField
  put fld "Injury" * fld "Occur" into tResult
  put tResult into fld "CalcField"
  --change backgroundColor of fld CalcField according to content.
  --between 1-10, red; between 11-19 yellow; between 20-25 green.
  local tColor = "white"
  if (tResult <= 10) then
    put "red" into tColor
  else if (tResult < 20) then
    put "yellow" into tColor
  else if (tResult <= 25) then
    put "green" into tColor
  end if
  set the backgroundColor of field "CalcField" to tColor
end mouseUp

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Rev 2.6 Not LiveCode

Post by BarrySumpter » Mon Aug 01, 2011 5:23 am

Whats the equilivant word for

Code: Select all

Select Case x
    case 1
      'do something
    case 2
      'do nothing
end select?
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

dglass
Posts: 519
Joined: Thu Sep 24, 2009 9:10 pm
Contact:

Re: Rev 2.6 Not LiveCode

Post by dglass » Mon Aug 01, 2011 5:32 am

Are you looking for 'switch'?

Code: Select all

 
switch the platform
  case "MacOS"
    put specialfolderpath("preferences") into tPreferenceLocation
    break
  case "Win32"
    put specialfolderpath("0x001a") into tPreferenceLocation
    break
end switch 

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Rev 2.6 Not LiveCode

Post by BarrySumpter » Mon Aug 01, 2011 5:48 am

Switch!

Where was that hiding all this time and why does it look so strange?
Man! I'm gettin old.

Hey! That was an excellent (meaning useful) example!
Thanks for that.

I asked cause the nested if above looked like it could use the Switch Case.

oops. And my appologies if Switch is implemented in a later release of Rev.
oops. And again my appologies if I've mistakenly deduced Rev 2.6 is just an earlier version of LiveCode 4.6.3.
Last edited by BarrySumpter on Thu Aug 04, 2011 5:06 am, edited 3 times in total.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

gray.nomad
Posts: 2
Joined: Mon Aug 01, 2011 12:29 am

Re: Rev 2.6 Not LiveCode

Post by gray.nomad » Mon Aug 01, 2011 11:10 am

Thank you gurus,
Thanks to all who replied.
Shaosean, I copy/paste you code and it worked instantly. What a live saver. I started to get grey hairs :x
Unfortunatly, Rev 2.6 is not supported anymore and I can understand why, but that is all the REV software that I
probably will ever need.
I wonder if someone could point me into where I could get code snippets/forums or other help for Rev 2.6.

In the meantime, thanks again for the help Shaosean and very best regards to all
Frank

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Rev 2.6 Not LiveCode

Post by shaosean » Mon Aug 01, 2011 11:25 am

Frank, just ask (but make sure to make a new topic).. I have a copy of Rev from 2.0 to 4.0 installed (have not touched anything branded LiveCode).. Other than some new features and some bug fixes, 2.6 will get you through the day and get your project completed..

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: Rev 2.6 Not LiveCode

Post by doc » Thu Aug 04, 2011 4:49 am

gray.nomad wrote:<snip>
I wonder if someone could point me into where I could get code snippets/forums or other help for Rev 2.6. <snip>
Hello Frank,
The online scripting conferences were all done right along the same time frame as Rev 2.6 and are still unbeatable for learning:
http://www.runrev.com/developers/lesson ... nferences/

They are extremely well done and a huge help to anyone facing the learning curve.

-Doc-

Post Reply