• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How can I set button text color, please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I set button text color, please


  • Subject: How can I set button text color, please
  • From: Brian Christmas <email@hidden>
  • Date: Fri, 08 Apr 2016 13:50:02 +1000


G’day scripters

I’ve come up with the following handler, but even though it’s running, it’s not setting the plain button text color to red.

The whole app then errors in my main loop.

Can anyone tell me what I’m  doing wrong, please (nothing about it in ‘Explored’).

Regards

Santa

displayError Running Loop.  Error -[NSNull pointSize]: unrecognized selector sent to instance 0x7fff76a2d780 error number -10000

on toggleErrorsEmailList:sender
try
set temp to sender's title() as text
if temp is "Display only Errors Emails List" as text then
if runForOz then say "setting red"
set my errorsListVisible to true
set p to 1
set myFont to current application's NSFont's fontWithName:"System Bold Regular" |size|:13 # Regular Bold
set p to 2
set AppleColors to current application's NSColorList's colorListNamed:"Apple"
set p to 3
set someColor to AppleColors's colorWithKey:"Red"
set p to 4
set attrsDict to current application's NSDictionary's dictionaryWithObjects:{myFont, someColor} forKeys:{current application's NSFontAttributeName, current application's NSForegroundColorAttributeName}
set p to 6
tell current application's NSAttributedString to set replacementText to alloc()'s initWithString:"Hide Errors Emails List" attributes:attrsDict
set p to 7
displayErrorsEmailsButton's setAttributedTitle:replacementText
# sender's setTitle:replacementText # "Hide Errors Emails List"
say 7 — < works, no errors here
else
set my errorsListVisible to false
set p to 8
set myFont to current application's NSFont's fontWithName:"System Regular" |size|:13 # Regular 
set p to 9
set AppleColors to current application's NSColorList's colorListNamed:"Apple"
set p to 10
set someColor to AppleColors's colorWithKey:"Black"
set p to 11
set attrsDict to current application's NSDictionary's dictionaryWithObjects:{myFont, someColor} forKeys:{current application's NSFontAttributeName, current application's NSForegroundColorAttributeName}
set p to 12
tell current application's NSAttributedString to set replacementText to alloc()'s initWithString:"Display only Errors Emails List" attributes:attrsDict
set p to 13
displayErrorsEmailsButton's setAttributedTitle:replacementText
# sender's setTitle:replacementText # "Display only Errors Emails List"
# sender's setTitle:"Display only Errors Emails List"
end if
on error errmsg
tell application "System Events" to display dialog "toggleErrorsEmailList error " & errmsg
end try
end toggleErrorsEmailList:


And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably

Sri Aurobindo



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How can I set button text color, please
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Stack overflow problem
  • Next by Date: Re: How can I set button text color, please
  • Previous by thread: Re: Stack overflow problem
  • Next by thread: Re: How can I set button text color, please
  • Index(es):
    • Date
    • Thread