The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Bringing graphic objects to front in OmniGraffle Thread Tools Search this Thread Display Modes
I can't find a means of bringing a selected graphic object to the front (as per the "Arrange > Bring to Front" Command)

Or indeed, sending it backwards.

Here's the issue. I'm using the following function to create links between nodes in a network, and the labels are (for whatever reason) drawing behind the connectors. I'd like to bring the label object forward, and can't.

Caveat: I'm new to AppleScript. It seems horribly undocumented.


Code:
on linkCircle(fromTag, toTag)
	tell application "OmniGraffle Professional 5"
		tell canvas of front window

			set fromCircle to the first solid whose tag = fromTag

			set toCircle to the first solid whose tag = toTag

			tell fromCircle
				set newConnection to connect to toCircle with ¬
				properties {line type:orthogonal}
			end tell
			
			set newLabel to make new shape at end of graphics ¬
			with properties {draws shadow:false, autosizing:full, ¬
			text:{text:"hello world", alignment:center}, ¬
			draws stroke:false}

			set labelConnection of newLabel to newConnection
		end tell
	end tell
end linkCircle
 
Quote:
Originally Posted by mediaczar View Post
I can't find a means of bringing a selected graphic object to the front (as per the "Arrange > Bring to Front" Command)
This is encoded in the order of the graphics collection of the canvas, so:

Code:
set newLabel to make new shape at beginning of graphics ¬
				with properties ¬
				{draws shadow:false, autosizing:full, text:{text:"hello world", alignment:center}, draws stroke:false}
 
Or, more generally:

Code:
on run
	tell application id "OGfl"
		tell front window
			set refGraphics to a reference to graphics of its canvas
			set lstSeln to selection
			repeat with oSeln in lstSeln
				my BringToFront(oSeln, refGraphics)
			end repeat
		end tell
	end tell
end run

on BringToFront(oGraphic, refGraphics)
	move oGraphic to beginning of refGraphics
end BringToFront

on SendToBack(oGraphic, refGraphics)
	move oGraphic to end of refGraphics
end SendToBack
 
Rob - many thanks. That's not only answered my question, but given me some insight into the whole approach. Was stumbling around in the dark before...

Thank you :)
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Illustrator CS6 objects are transparent when pasted in Omnigraffle peterlockhart OmniGraffle General 5 2013-02-08 05:11 PM
applescript to copy an OmniGraffle graphic? supertwang AppleScripting Omni Apps 3 2011-12-08 09:56 PM
AppleScript - How to Operate on Group of Selected Graphic Objects? trouble clef OmniGraffle General 1 2011-08-17 06:24 AM
Using graphic objects as stencil items? (+ 2 hints) epo OmniGraffle Extras 0 2006-08-18 01:47 AM
Bringing the mailing list online... JKT OmniWeb General 10 2006-03-24 04:14 AM


All times are GMT -8. The time now is 12:45 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.