AS - TOOLBAR problem..

I need to open one my window in display mode in to Simple toolbar :frowning: i use SIMPLE TOOLBAR sample code for my litle application
this is my question, i replace this code and the new window not appare … the problem is :

Not work


on clicked toolbar item theObject
	if identifier of theObject is "compile item identifier" then
		
		display panel "window2" attached to the front window  -- Not work :(
              display window "window2" attached to the front window  -- Not work :(
		
		
	end if
end clicked toolbar item

WORK


on clicked toolbar item theObject
	if identifier of theObject is "compile item identifier" then
		display open panel  attached to the front window  -- WORK good
		
	end if
end clicked toolbar item

Full sample code


property panelWIndow : missing value


on data representation theObject of type ofType
	(*Return the data that is to be stored in your document here.*)
end data representation

on load data representation theObject of type ofType with data withData
	(* The withData contains the data that was stored in your document that you provided in the "data representation" event handler. Return "true" if this was successful, or false if not.*)
	return true
end load data representation


-- This event handler is attached to the table view in our nib. It is a good place to set the contents of the table view and to setup any drag types that we might desire.
--
on awake from nib theObject
	-- Make the new toolbar, giving it a unique identifier
	set documentToolbar to make new toolbar at end with properties {name:"document toolbar", identifier:"document toolbar identifier", allows customization:true, auto sizes cells:true, display mode:default display mode, size mode:default size mode}
	
	-- Setup the allowed and default identifiers.
	set allowed identifiers of documentToolbar to {"compile item identifier", "run item identifier", "stop item identifier", "font item identifier", "print item identifier", "customize toolbar item identifer", "flexible space item identifer", "space item identifier", "separator item identifier"}
	set default identifiers of documentToolbar to {"compile item identifier", "run item identifier", "stop item identifier", "font item identifier"}
	
	--set selectable identifiers of documentToolbar to {}
	
	-- Create the toolbar items, adding them to the toolbar.
	make new toolbar item at end of toolbar items of documentToolbar with properties {identifier:"compile item identifier", name:"compile item", label:"Compile", palette label:"Compile", tool tip:"Compile", image name:"CompileScript"}
	make new toolbar item at end of toolbar items of documentToolbar with properties {identifier:"run item identifier", name:"run item", label:"Test", palette label:"Run", tool tip:"Run", image name:"RunScript"}
	make new toolbar item at end of toolbar items of documentToolbar with properties {identifier:"stop item identifier", name:"stop item", label:"Stop", palette label:"Stop", tool tip:"Stop", image name:"StopScript"}
	
	
	-- Duplicate
	make new toolbar item at end of toolbar items of documentToolbar with properties {identifier:"font item identifier", name:"font item", label:"font", palette label:"font", tool tip:"font", image name:"font"}
	
	-- Assign our toolbar to the window
	set toolbar of theObject to documentToolbar
end awake from nib

-- This event handler is called when the user clicks on one of the toolbar items Inserimanto comandi dei bottoni nel tool bar
--
on clicked toolbar item theObject
	if identifier of theObject is "compile item identifier" then
		--display dialog "It's time to compile" attached to the front window -- WORK is the original code  
		--display open panel attached to the front window  -- WORK
		
(* i neet open one my window in display mode *)
		
		display window "window2" attached to the front window  --NOT WORK
		
		display window "window2" attached to the  window "main"  --NOT WORK
	end if
		
		
end clicked toolbar item

-- This event handler is called whenever the state of the toolbar items needs to be changed.
--
on update toolbar item theObject
	-- We return true in order to enable the toolbar item, otherwise we would return false
	return true
end update toolbar item



Someone have idea to risolve this … thanx all user

Model: G5 DP 2700
AppleScript: 2.1
Browser: Safari 412.2.2
Operating System: Mac OS X (10.4)

:smiley: very thanx jaques it WORK :slight_smile:

Model: G5 DP 2700
AppleScript: 2.1
Browser: Safari 412.2.2
Operating System: Mac OS X (10.4)