Help with a handler

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

Post Reply
amelia16
Posts: 3
Joined: Sat Apr 21, 2018 10:07 pm

Help with a handler

Post by amelia16 » Mon Apr 23, 2018 4:39 pm

I'm doing an application where the user can paint a house and I have a list of the colors on a field and I want the user to click on a color and click on a section of the house, like the chimney or the door (each section has a graphic outlining it) and I want the background color to change to the color they chose but I have not the slightest clue how to do that! Please help!

This is my handler so far:

on mouseUp
repeat for each line
set the color of me to the backgroundColor of the target
end repeat
end mouseUp

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5483
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Help with a handler

Post by dunbarx » Mon Apr 23, 2018 4:50 pm

Hi.

Experiment. Make a locked field named "colorList" with some color names on each line and a couple of buttons on a new card. Do not name the buttons quite yet. Put this in the card script:

Code: Select all

on mouseUp
   if "colorList" is in the name of the target then
      set the currentColor of this cd to the clickText
   end if

   if "button" is in the name of the   target then
      set the backColor of the target to the currentColor of this cd
   end if
end mouseUp
Click on any line in the field. Click on any button.

Craig Newman

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”