G'day Scripters.
I now have a very elegant pop-up sheet with 9 item on it, but my next one needs 33!!
It would be excellent if I did not have to type in 33 items of code to set an array and corresponding images.
I've tried using (sender) as a reference where the array items were named the same as the sending items, but it did not work.
Where the array was 'set theHoldingArray to {setSunday:false}' and the controller name was set to 'setSunday'
-- ________________ Sets up theDays data (an Array as part of arrangedObjects) _________________
on setAllTheDays_(sender)
if sender = setDaysFinished then
setTheDaysWindow's orderOut_(me)
end if
if sender = setEveryDay then
if theHoldingDaysArray's setEveryDayStore=false then
set theHoldingDaysArray's setEveryDayStore to true
set theHoldingDaysArray's setSundayStore to true
set theHoldingDaysArray's setMondayStore to true
set theHoldingDaysArray's setTuesdayStore to true
set theHoldingDaysArray's setWednesdayStore to true
set theHoldingDaysArray's setThursdayStore to true
set theHoldingDaysArray's setFridayStore to true
set theHoldingDaysArray's setSaturdayStore to true
set temp to my displaySetAllTheDays_()
else
set theHoldingDaysArray's setEveryDayStore to false
my displaySetAllTheDays_()
end if
end if
if theHoldingDaysArray's setEveryDayStore=false
set theDaysCheckFlag to false
if sender = setSunday then
if theHoldingDaysArray's setSundayStore = false then
set theHoldingDaysArray's setSundayStore to true
else
set theHoldingDaysArray's setSundayStore to false
end if
end if
if sender = setMonday then
if theHoldingDaysArray's setMondayStore = false then
set theHoldingDaysArray's setMondayStore to true
else
set theHoldingDaysArray's setMondayStore to false
end if
end if
if sender = setTuesday then
if theHoldingDaysArray's setTuesdayStore = false then
set theDaysCheckFlag to true
else
set theHoldingDaysArray's setTuesdayStore to false
end if
end if
if sender = setWednesday then
if theHoldingDaysArray's setWednesdayStore = false then
set theHoldingDaysArray's setWednesdayStore to true
else
set theHoldingDaysArray's setWednesdayStore to false
end if
end if
if sender = setThursday then
if theHoldingDaysArray's setThursdayStore = false then
set theHoldingDaysArray's setThursdayStore to true
else
set theHoldingDaysArray's setThursdayStore to false
end if
end if
if sender = setFriday then
if theHoldingDaysArray's setFridayStore = false then
set theHoldingDaysArray's setFridayStore to true
else
set theHoldingDaysArray's setFridayStore to false
end if
end if
if sender = setSaturday then
if theHoldingDaysArray's setSaturdayStore = false then
set theHoldingDaysArray's setSaturdayStore to true
else
set theHoldingDaysArray's setSaturdayStore to false
end if
end if
set theDaysCheckFlag to my displaySetAllTheDays_()
if not theDaysCheckFlag then
my sayTheSoundError_("You must have at least one day set.",true)
my setAllTheDays_(setEveryDay)
end if
end if
end setAllTheDays
on displaySetAllTheDays_()
set theDaysCheckFlag to false
if theHoldingDaysArray's setEveryDayStore=true then
setEveryDay's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setEveryDay's setImage_forSegment_(redCircle,0)
end if
if theHoldingDaysArray's setSundayStore = true then
setSunday's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setSunday's setImage_forSegment_(redCircle,0)
end if
if theHoldingDaysArray's setMondayStore = true then
setMonday's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setMonday's setImage_forSegment_(redCircle,0)
end if
if theHoldingDaysArray's setTuesdayStore = true then
setTuesday's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setTuesday's setImage_forSegment_(redCircle,0)
end if
if theHoldingDaysArray's setWednesdayStore = true then
setWednesday's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setWednesday's setImage_forSegment_(redCircle,0)
end if
if theHoldingDaysArray's setThursdayStore = true then
setThursday's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setThursday's setImage_forSegment_(redCircle,0)
end if
if theHoldingDaysArray's setFridayStore = true then
setFriday's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setFriday's setImage_forSegment_(redCircle,0)
end if
if theHoldingDaysArray's setSaturdayStore = true then
setSaturday's setImage_forSegment_(greenCircle,0)
set theDaysCheckFlag to true
else
setSaturday's setImage_forSegment_(redCircle,0)
end if
return theDaysCheckFlag
end displaySetAllTheDays_