How to check if a checkbox button is true or false?

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
3d-swiss
Posts: 39
Joined: Thu Nov 06, 2008 9:11 pm

How to check if a checkbox button is true or false?

Post by 3d-swiss » Fri Jan 06, 2012 2:59 pm

I've create a button as Checkbox and named it 'bTXTDatei'.

On a script of a push button I like to check, if 'bTXTDatei' is True or False like this:

Code: Select all


on mouseUp
   if  button "bTXTDatei" is true then  -- here is the problem, that is always FALSE
      -- use .txt as extension
   else
      -- use .vcf as extension
   end if
end mouseUp
Where is my mistake. How can I check, if the Checkbox is set/true or unset/false?

Best regards from Switzerland

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: How to check if a checkbox button is true or false?

Post by gpb01 » Fri Jan 06, 2012 3:47 pm

Hi from Switzerland (Locarno),

use the "hilite" http://docs.runrev.com/Property/hilite property ...

if the hilite of button "MyButton" then ...

or, if the script is inside the checkbox you can use : if the hilite of me then ....

In your sample :

Code: Select all

    on mouseUp
       if the hilite of button "bTXTDatei" then
          -- use .txt as extension
       else
          -- use .vcf as extension
       end if
    end mouseUp
Guglielmo

Post Reply