diff options
author | culler <culler> | 2020-08-15 13:02:36 (GMT) |
---|---|---|
committer | culler <culler> | 2020-08-15 13:02:36 (GMT) |
commit | 596eb400c9a112d7fa41054520f238ab50438eff (patch) | |
tree | 30d8390f8932ff2fa17f8458c92b435d5b485b15 /macosx/README | |
parent | c9bb96468f1ed1e24b9aaa8df6f69cbba9665680 (diff) | |
parent | 5bf62fe2ba4d3ca755030e190515a1e46c6e0bc7 (diff) | |
download | tk-596eb400c9a112d7fa41054520f238ab50438eff.zip tk-596eb400c9a112d7fa41054520f238ab50438eff.tar.gz tk-596eb400c9a112d7fa41054520f238ab50438eff.tar.bz2 |
Fix [315104a5c1] - corrects and extends the virtual event notifications of appearance changes.
Diffstat (limited to 'macosx/README')
-rw-r--r-- | macosx/README | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/macosx/README b/macosx/README index a3f10b6..9745d14 100644 --- a/macosx/README +++ b/macosx/README @@ -662,15 +662,35 @@ source and destination rectangles for the scrolling. The embedded windows are redrawn within the DisplayText function by some conditional code which is only used for macOS. -6.0 Virtual events on 10.14 -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +6.0 Virtual events on macOS 10.14 and later +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The 10.14 release added support for system appearance changes, +including a "Dark Mode" that renders all window frames and menus in +dark colors. Tk 8.6.11 provides three virtual events <<LightAqua>>, +<<DarkAqua>> and <<AppearanceChanged>>, to allow you to update your Tk +app's appearance when the system appearance changes. These events are +generated in [NSView effectiveAppearanceChanged], which is called by +the Apple window manager when the General Preferences is changed +either by switching between Light Mode and Dark Mode or by changing +the Accent Color or Highlight Color. + +The <<AppearanceChanged>> virtual event has a data string which can be +accessed with the %d substitution. The format of the data string is +that it consists of 6 words: + "Appearance XXXX Accent YYYY Highlight ZZZZ" +For example, the following code will print the current appearance +name, accent color and highlight color when the <<AppearanceChanged>> +virtual event fires: + +bind . <<AppearanceChanged>> { + array set data [split %d] + puts " Appearance: $data(Appearance)" + puts " Accent: $data(Accent)" + puts " Highlight: $data(Highlight)\n" +} + -10.14 supports system appearance changes, and has added a "Dark Mode" -that casts all window frames and menus as black. Tk 8.6.9 has added two -virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update -your Tk app's appearance when the system appearance changes. Just bind -your appearance-updating code to these virtual events and you will see -it triggered when the system appearance toggles between dark and light. 7.0 Mac Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |