Switch Button Widget

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: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
nrprioleau
Posts: 27
Joined: Mon May 09, 2016 10:53 am

Switch Button Widget

Post by nrprioleau » Thu Aug 25, 2016 9:42 am

Please can someone explain why this code in my switch button generates an error in the IDE as well as the standalone?

Code: Select all

on hiliteChanged
   put the hilited of me into tAction
   doChangeRecord tAction
end hiliteChanged

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

Re: Switch Button Widget

Post by bn » Thu Aug 25, 2016 9:59 am

Hi nrprioleau,

change your code to

Code: Select all

on hiliteChanged
   put the hilite of me into tAction
   doChangeRecord tAction
end hiliteChanged
there seems to be an error in the default script of the switch button: the property is not "hilited" but "highlight" or "hilite"

Kind regards
Bernd

Edit: I reported this as a bug:

http://quality.livecode.com/show_bug.cgi?id=18260

Edit of the Edit:

it is not a bug because I just dragged the switch button off the toolbar and it did not show the status in the message box. It turns out that the script has to be opened once and compiled for it to work.

I marked the bug report as "not a bug"

But this leaves the question why your script does not work. It seems the problem is not in the default script of the switch button but further down in your handler "doChangeRecord tAction".

nrprioleau
Posts: 27
Joined: Mon May 09, 2016 10:53 am

Re: Switch Button Widget

Post by nrprioleau » Thu Aug 25, 2016 1:55 pm

Hi thanks, that worked great!

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”