Methods and BWToolkitFramework

Hello everyone,

I’ve just recently begun to explore the vast wonderland that is ApplescriptObjc, so far I find it quite exciting. I am working on a small application at the moment and have run in to a bit of a brick wall…

I am trying to work with a Method that comes with the “sheet controller” which is a part of BWToolkit. In the source file there is the following little bit of instruction…

// The optional delegate should implement the method:
// - (BOOL)shouldCloseSheet:(id)sender
// Return YES if you want the sheet to close after the button click, NO if it shouldn't close. The sender
// object is the button that requested the close. This is helpful because in the event that there are multiple buttons
// hooked up to the messageDelegateAndCloseSheet: method, you can distinguish which button called the method. 

I am trying to be able to click on a button to close a sheet, and at the same time send a message to the delegate, I have it working with the following modified method…

on shouldCloseSheet_(sender)
// Script here
end shouldCloseSheet_

However, I need to somehow identify the button in that method, so that all the other sheets that want to message the delegate don’t point right to that method. Does my question make any sense whatsoever?


If you want to close a sheet from a button (it has to be on the sheet, of course) then

on closesheet_(sender)
	sheet_'s orderOut_(me)
end closesheet_

Does that help? :smiley:

You can distinguish a button by its title or tag.

sender's title
sender's tag

If your using BWToolKit you don’t need to hard code a sheet closing method. One if provided for you already just ctrl- drag your button to the sheet controller and select close sheet