Check-in [8ecc901f75]

Login
Bounty program for improvements to Tcl and certain Tcl packages.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tweak example in tip 536
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8ecc901f75c676257d12fa4d9f56ec08e2860df29ead33c0bc33371c41e87f55
User & Date: kevin_walzer 2019-04-18 01:54:23
Context
2019-04-19
14:18
Fix formatting in 411 check-in: 3b25ece3be user: dkf tags: trunk
2019-04-18
01:54
Tweak example in tip 536 check-in: 8ecc901f75 user: kevin_walzer tags: trunk
2019-04-16
13:31
TIP 342 is Final check-in: 53c69e3a9d user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tip/536.md.

23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
The following commands, which will all be documented in the tk::mac section of the Tk man page, will be added with this TIP: 

## ::tk::mac::PerformService

Executes a Tcl procedure called from the macOS "Services" menu by another application in the Apple menu item. The "Services" menu item allows for inter-application communication; data from one application, such as selected text, can be sent to another application for processing, for example to Safari as a search item for Google, or to TextEdit to be appended to a file. Tk will includes a stub version of this command that displays a dialog with the data sent. This procedure should be rewritten in an application script for customization, which will allow a Tk application to expose "Service" functionality to other programs: 

	proc ::tk::mac::PerformService {} {
		set w [pack [text .t]]

		set data [clipboard get]
		$w insert end $data
	}
	
Note that the mechanism for retrieving inter-application data is from the clipboard; there is no other supported way to obtain the data. If the Services process is not desired, the NSServices keys can be deleted from the application's Info.plist file. 

The underlying code supporting this command also allows the text, entry and ttk::entry widgets to access/consume services from other applications via the Services menu. 






|
>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
The following commands, which will all be documented in the tk::mac section of the Tk man page, will be added with this TIP: 

## ::tk::mac::PerformService

Executes a Tcl procedure called from the macOS "Services" menu by another application in the Apple menu item. The "Services" menu item allows for inter-application communication; data from one application, such as selected text, can be sent to another application for processing, for example to Safari as a search item for Google, or to TextEdit to be appended to a file. Tk will includes a stub version of this command that displays a dialog with the data sent. This procedure should be rewritten in an application script for customization, which will allow a Tk application to expose "Service" functionality to other programs: 

	proc ::tk::mac::PerformService {} {
		set w [text .t]
		pack $w
		set data [clipboard get]
		$w insert end $data
	}
	
Note that the mechanism for retrieving inter-application data is from the clipboard; there is no other supported way to obtain the data. If the Services process is not desired, the NSServices keys can be deleted from the application's Info.plist file. 

The underlying code supporting this command also allows the text, entry and ttk::entry widgets to access/consume services from other applications via the Services menu.