Freeze a Checkbox

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
bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Freeze a Checkbox

Post by bidgeeman » Thu Oct 29, 2009 1:30 am

Is there a way to have a checkbox "Stay" selected once it is checked?Even if the user clicks on it again?

Thanks
Bidge

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Location: Kent, UK
Contact:

Post by gyroscope » Thu Oct 29, 2009 2:13 am

Hi Bidge, one way would be:

Code: Select all

on mouseUp
   if the hilite of me is true then
      exit mouseUp
else
   if the hilite of me is false then
      set the hilite of me to true
   end if
   end if
end mouseUp
:)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Post by bidgeeman » Thu Oct 29, 2009 2:48 am

Hey thanks Gyro :)

Cheers
Bidge

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Post by mwieder » Thu Oct 29, 2009 5:05 am

Bidge-

Not really sure why you'd want to do this, but I can condense gyro's answer even further:

Code: Select all

on mouseUp
    set the hilite of me to true
end mouseUp
<g>

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

Post by Mark » Thu Oct 29, 2009 11:11 am

Hi,

Just set the autohilite of the checkbox to false.

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4003
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Thu Oct 29, 2009 11:11 am

Bidge,

you confuse the user if you offer him a checkbox and the user can not check it. For the user interface it would be better to disable a checkbox if you want to freeze it.

Code: Select all

set the disabled of btn 1 to true
this dimms the checkbox and the user has a clue that it is not functional. Otherwise the user thinks your program does not work.
regards
Bernd

gyroscope
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 404
Joined: Tue Jan 08, 2008 3:44 pm
Location: Kent, UK
Contact:

Post by gyroscope » Thu Oct 29, 2009 11:12 am

Not really sure why you'd want to do this, but I can condense gyro's answer even further:

Code: Select all

on mouseUp 
    set the hilite of me to true 
end mouseUp
Doh, again!! :oops: I'd swear in court that that didn't work for me last night! Although in the light of day I see that it must. (I replied at a quarter to 2 in the morning: that is my excuse for the day... :wink:

:)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Post by bidgeeman » Thu Oct 29, 2009 10:44 pm

Hi.
Explanation: I wanted to make a checkbox that was only selectable once by the user so that they would have to click a "Clear all Fields" button to restart a new seletion.

Many thanks again for all the responses.
Regards
Bidge

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”