Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Dave
i tried this just to get something working for now, but it doesn’t seem to 
affect where the Alert is displayed.

myAlert = [NSAlert alertWithMessageText:@Do you really want to do that? 
defaultButton:@“No alternateButton:@“Yes otherButton:nil 
informativeTextWithFormat:@It might cause mayhem!”];

myAlertWindow = myAlert.window;
myAlertWindowFrameRect = myAlertWindow.frame;
myAlertWindowFrameRect.origin = myNewOrigin;
[myAlertWindow setFrame:myAlertWindowFrameRect display:YES];

myAlertResponse = [myAlert runModal];
if (myAlertResponse == kDialogResponseYes)
{
}
else
{
}

I’ll investigate doing it using a sheet next week, but it would be nice to have 
the Alert working in the meantime.

Thanks
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Shane Stanley
On 27 Mar 2015, at 12:55 pm, Scott Ribe scott_r...@elevated-dev.com wrote:
 
 Be warned, starting with Mavericks things went wacko-batshit stupid if the 
 sheet is near the screen bounds...

My app is 10.9 and later only, but I think I'm mostly protected by virtue of a 
minimum size for that splitview subview. (My use of it elsewhere with an open 
panel is more problematic, however. I just can't think of anything better.) 

And full-screen mode just puts them back at the top of the window regardless.

-- 
Shane Stanley sstan...@myriad-com.com.au
www.macosxautomation.com/applescript/apps/


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Storyboard warning: internationalization of (null)

2015-03-26 Thread Michael Crawford
Yes, my specific task is to make this run on all versions of OS X
starting with 10.6, including 10.10.

I have the sense - I don't specifically know - that my client is new
to OS X development.  Maybe he used a storyboard because that's what
he thought he was supposed to do.

I can fix his problem by implementing an NSViewController subclass
that looks and works like his present - single-window - storyboard.  I
could either load the storyboard on 10.10 or later, or possibly do
without the storyboard at all.

My client's project is at a very basic state of development.  I think
I should ask him how he wants me to proceed.  I think it would help if
I were to make two very simple example projects, that show the two
alternatives.

Mike
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Thu, Mar 26, 2015 at 9:48 PM,  dangerwillrobinsondan...@gmail.com wrote:
 I think the problem is storyboards are not available prior to 10.10
 Is that going to run on anything earlier?

 Sent from my iPhone

 On 2015/03/27, at 13:26, Michael Crawford mdcrawf...@gmail.com wrote:

 Xcode wanted the storyboard to be within a folder called en.lproj.
 Previously it was in a folder called Base.

 I removed the reference to the storyboard from my project, then in the
 Finder I renamed the Base folder to en.lproj, then re-added the
 storyboard.  After I did a build the warning went away.
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
 Area.


 On Wed, Mar 25, 2015 at 1:19 AM, Geoffrey Goutallier
 cod...@farfadet.net wrote:
 Do not have the answer, but maybe have a look at your project settings 
 'Info' tab and in 'localizations'. Maybe you have here an extra language 
 set, but no corresponding 'xxx.lprol' on disk...
 Hope that helps...

 ++GG

 On 25 Mar 2015, at 8:17, Michael Crawford mdcrawf...@gmail.com wrote:

 I'm debugging a project for a client; he got his OS X App mostly
 working, then sent it to me to fix.  I know how to handle his most
 serious problem, but I'd like also to silence all the warnings.

  Main.storyboard: Internationalization of (null) is not available
 when compiling for targets before Mac OS X 10.8

 I don't see where that null occurs.  I'm guessing that it's a null
 string but it might be some other Cocoa object that's null.  I've
 clicked all around in Interface Builder, prayed to The Series Of Tubes
 c. but no insight has resulted.

 Is there a way I can determine what this warning refers to?

 Thanks,

 Mike
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/

  Available for Software Development in the Portland, Oregon Metropolitan
 Area.
 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/coding%40farfadet.net

 This email sent to cod...@farfadet.net
 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com

 This email sent to dangerwillrobinsondan...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Storyboard warning: internationalization of (null)

2015-03-26 Thread Michael Crawford
Xcode wanted the storyboard to be within a folder called en.lproj.
Previously it was in a folder called Base.

I removed the reference to the storyboard from my project, then in the
Finder I renamed the Base folder to en.lproj, then re-added the
storyboard.  After I did a build the warning went away.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Wed, Mar 25, 2015 at 1:19 AM, Geoffrey Goutallier
cod...@farfadet.net wrote:
 Do not have the answer, but maybe have a look at your project settings 'Info' 
 tab and in 'localizations'. Maybe you have here an extra language set, but no 
 corresponding 'xxx.lprol' on disk...
 Hope that helps...

 ++GG

 On 25 Mar 2015, at 8:17, Michael Crawford mdcrawf...@gmail.com wrote:

 I'm debugging a project for a client; he got his OS X App mostly
 working, then sent it to me to fix.  I know how to handle his most
 serious problem, but I'd like also to silence all the warnings.

   Main.storyboard: Internationalization of (null) is not available
 when compiling for targets before Mac OS X 10.8

 I don't see where that null occurs.  I'm guessing that it's a null
 string but it might be some other Cocoa object that's null.  I've
 clicked all around in Interface Builder, prayed to The Series Of Tubes
 c. but no insight has resulted.

 Is there a way I can determine what this warning refers to?

 Thanks,

 Mike
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
 Area.
 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/coding%40farfadet.net

 This email sent to cod...@farfadet.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Storyboard warning: internationalization of (null)

2015-03-26 Thread dangerwillrobinsondanger
I think the problem is storyboards are not available prior to 10.10
Is that going to run on anything earlier?

Sent from my iPhone

 On 2015/03/27, at 13:26, Michael Crawford mdcrawf...@gmail.com wrote:
 
 Xcode wanted the storyboard to be within a folder called en.lproj.
 Previously it was in a folder called Base.
 
 I removed the reference to the storyboard from my project, then in the
 Finder I renamed the Base folder to en.lproj, then re-added the
 storyboard.  After I did a build the warning went away.
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/
 
   Available for Software Development in the Portland, Oregon Metropolitan
 Area.
 
 
 On Wed, Mar 25, 2015 at 1:19 AM, Geoffrey Goutallier
 cod...@farfadet.net wrote:
 Do not have the answer, but maybe have a look at your project settings 
 'Info' tab and in 'localizations'. Maybe you have here an extra language 
 set, but no corresponding 'xxx.lprol' on disk...
 Hope that helps...
 
 ++GG
 
 On 25 Mar 2015, at 8:17, Michael Crawford mdcrawf...@gmail.com wrote:
 
 I'm debugging a project for a client; he got his OS X App mostly
 working, then sent it to me to fix.  I know how to handle his most
 serious problem, but I'd like also to silence all the warnings.
 
  Main.storyboard: Internationalization of (null) is not available
 when compiling for targets before Mac OS X 10.8
 
 I don't see where that null occurs.  I'm guessing that it's a null
 string but it might be some other Cocoa object that's null.  I've
 clicked all around in Interface Builder, prayed to The Series Of Tubes
 c. but no insight has resulted.
 
 Is there a way I can determine what this warning refers to?
 
 Thanks,
 
 Mike
 Michael David Crawford, Consulting Software Engineer
 mdcrawf...@gmail.com
 http://www.warplife.com/mdc/
 
  Available for Software Development in the Portland, Oregon Metropolitan
 Area.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/coding%40farfadet.net
 
 This email sent to cod...@farfadet.net
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com
 
 This email sent to dangerwillrobinsondan...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

NSAppleScript Problem

2015-03-26 Thread Dave
Hi,

I’m running the following Script from a Cocoa App using NSAppleScript:

set myWindowName to Test 2
set myNewSubject to [High] Test 2
tell application id com.microsoft.Outlook
activate
save front window
set myMessageList to current messages
set myMessage to item 1 of myMessageList
set mySubject to the subject of myMessage
set the subject of myMessage to myNewSubject
save front window
end tell

The Script doesn’t work, e.g it doesn’t change the Subject field, however if I 
run it under the Script Editor it works ok.

The Script compiles and runs with no errors from compileAndReturnError:

Not sure why it doesn’t work and not sure where to start looking?

All the Best
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Graham Cox

 On 27 Mar 2015, at 10:45 am, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 Without knowing more context, I’m not sure NSPopover is the right thing 
 either. If not, it probably ought to be some kind of custom NSPanel.


One situation I think would be a suitable candidate for a custom-positioned 
alert (or popover) is when a text field fails validation. At the moment, 
there's little support for handling this gracefully - I think the default 
response is to beep and refuse losing first responder status. It's pretty poor, 
in that it doesn't give the user any clue as to what they've done wrong, and 
beeping is such a passive-aggressive means of signalling a problem - You're a 
moron, but try and guess why, ha-ha!.

A nicely positioned alert with a popover-style triangle that indicates the 
field in question with some explanation of the problem would be a lot better. I 
could be staged, so that it only appears on the second fail, etc. Of course 
some way to turn it off would also be needed, so that a user who has got used 
to the various reasons for failure won't be bombarded with messages when a beep 
is sufficient to remind them.

Of course I've no idea whether this is what the OP's requirement is, he doesn't 
say.

--Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread dangerwillrobinsondanger



 On 2015/03/27, at 9:10, Graham Cox graham@bigpond.com wrote:
 
 
 On 27 Mar 2015, at 10:45 am, Quincey Morris 
 quinceymor...@rivergatesoftware.com wrote:
 
 Without knowing more context, I’m not sure NSPopover is the right thing 
 either. If not, it probably ought to be some kind of custom NSPanel.
 
 
 One situation I think would be a suitable candidate for a custom-positioned 
 alert (or popover) is when a text field fails validation. At the moment, 
 there's little support for handling this gracefully - I think the default 
 response is to beep and refuse losing first responder status. It's pretty 
 poor, in that it doesn't give the user any clue as to what they've done 
 wrong, and beeping is such a passive-aggressive means of signalling a problem 
 - You're a moron, but try and guess why, ha-ha!.
 
 A nicely positioned alert with a popover-style triangle that indicates the 
 field in question with some explanation of the problem would be a lot better. 
 I could be staged, so that it only appears on the second fail, etc. Of course 
 some way to turn it off would also be needed, so that a user who has got used 
 to the various reasons for failure won't be bombarded with messages when a 
 beep is sufficient to remind them.
 
 Of course I've no idea whether this is what the OP's requirement is, he 
 doesn't say.
 
 --Graham
Sheets are used if you're using NSFormatters or Bindings aren't they?

Agreed though that even that is often pretty stinky compared to what we are 
used to with good web forms for example.

I believe this sheet position API is intended for things like custom borderless 
windows where AppKit couldn't guess where it should go. 

 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/dangerwillrobinsondanger%40gmail.com
 
 This email sent to dangerwillrobinsondan...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Quincey Morris
On Mar 26, 2015, at 17:10 , Graham Cox graham@bigpond.com wrote:
 
 One situation I think would be a suitable candidate for a custom-positioned 
 alert (or popover) is when a text field fails validation. At the moment, 
 there's little support for handling this gracefully - I think the default 
 response is to beep and refuse losing first responder status. It's pretty 
 poor, in that it doesn't give the user any clue as to what they've done 
 wrong, and beeping is such a passive-aggressive means of signalling a problem 
 - You're a moron, but try and guess why, ha-ha!”.

IIRC the HIG suggests you leave space in your window layout so that you can 
display an icon and a brief error message in the window itself. OTOH 
beep-and-refuse is a venerable tradition, and what customer has ever resented 
being treated like a moron?

http://www.cartoonbuddyblog.com/2010/05/hit-any-key-to-continue-english-cartoon.html
 
http://www.cartoonbuddyblog.com/2010/05/hit-any-key-to-continue-english-cartoon.html

 A nicely positioned alert with a popover-style triangle that indicates the 
 field in question with some explanation of the problem would be a lot better.

Yup.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Inserting a task into the run loop

2015-03-26 Thread Frank D. Engel, Jr.

I think you might be able to use this:

[object performSelectorOnMainThread:(SEL)aSelector
  withObject:nil
  waitUntilDone:NO];


If I am interpreting the behavior of that call correctly, you would need 
to call that once to get it started, then at the end of the method that 
aSelector points to each time it runs until it is time to stop (then 
just stop calling that).




On 3/23/2015 01:49, Roland King wrote:

On 23 Mar 2015, at 13:05, Graham Cox graham@bigpond.com wrote:



On 23 Mar 2015, at 12:47 pm, Graham Cox graham@bigpond.com wrote:

But what actual form would a task take that said loop as many times as necessary 
until there's no more to do, then finish?


Just to clarify, as re-reading this it isn't clear what I really mean:

I mean a task that will loop on each turn of the run loop until done, then 
finish. Seems to me there isn't really anything that quite fits that - an 
NSOperation fires once, so I'd need to keep creating these and rescheduling 
them. Maybe that's OK, performance wise? Alternatively a timer can be made to 
fire once per run loop, but never stops. Maybe a thread with a lock really is 
the best approach here, especially as it punts the simulation on to a second 
processor so it can run as fast as possible as long as it needs to. The hassle 
there is messaging the main thread for UI updates and all the usual 
multi-threaded gotchas.

I've had lots of helpful suggestions (thanks!), but the best way forward is 
still not that obvious.

—Graham


Why not just enqueue a block on the main queue, if you want it to be on the 
main thread. if you determine you have more work to do, ie another iteration is 
required, you enqueue another one asynchronously at the end. A quick test seems 
to indicate that the main loop goes around and services all the other things it 
has to do before dequeueing the next block off the main queue, thus keeping the 
UI active.

Personally I’d probably make a separate queue just for the simulation and make 
all changes to the model by posting blocks to that queue, keep the entire model 
running away from the UI, then post changes back the other way to update the UI 
because I’m pretty sure sooner or later I’d run into performance issues running 
the simulation on the main thread.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/fde101%40fjrhome.net

This email sent to fde...@fjrhome.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSAppleScript Problem

2015-03-26 Thread Marek Hrušovský
Have you tried executing the script?

// Execute the script, compiling it first if it is not already compiled.
Return the result of executing the script, or nil and a pointer to an error
information dictionary for failure.

- (NSAppleEventDescriptor *)executeAndReturnError:(NSDictionary
**)errorInfo;

On Fri, Mar 27, 2015 at 7:22 AM, Dave d...@looktowindward.com wrote:

 Hi,

 I’m running the following Script from a Cocoa App using NSAppleScript:

 set myWindowName to Test 2
 set myNewSubject to [High] Test 2
 tell application id com.microsoft.Outlook
 activate
 save front window
 set myMessageList to current messages
 set myMessage to item 1 of myMessageList
 set mySubject to the subject of myMessage
 set the subject of myMessage to myNewSubject
 save front window
 end tell

 The Script doesn’t work, e.g it doesn’t change the Subject field, however
 if I run it under the Script Editor it works ok.

 The Script compiles and runs with no errors from compileAndReturnError:

 Not sure why it doesn’t work and not sure where to start looking?

 All the Best
 Dave


 ___

 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com

 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/xhruso00%40gmail.com

 This email sent to xhrus...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Quincey Morris
On Mar 26, 2015, at 16:00 , Graham Cox graham@bigpond.com wrote:
 
 Your requirement isn't clear - do you want a sheet to appear as if unattached 
 to a host window, just floating in space? Even if you can achieve it, users 
 will simply assume your app is buggy. Ideas like this are never seen in the 
 wild for good reason.

I’ve been following this thread from the beginning, and have come to the 
conclusion that the OP was never interested in an alert or a sheet as such. I 
think what’s being asked for is just an anchored app- or window-modal floating 
panel that displays an error message. There really isn’t a standard UI element 
of this kind (that I can think of). The nearest would be a non-dismissable 
popover anchored at the point of the error.

If the intention is that the “alert” should be app-modal, then a modal NSAlert 
window has the correct behavior, but there are consistency reasons for not 
moving it from its standard position.

If the intention is that the “alert” should be window-modal, and positioned 
relative to the window, then a sheet with custom positioning 
(window:willPositionSheet:usingRect:) would have the correct behavior, but 
AFAIK custom sheet positioning is basically never done. (And I don’t know that 
you can force custom positioning on a NSAlert sheet.)

Without knowing more context, I’m not sure NSPopover is the right thing either. 
If not, it probably ought to be some kind of custom NSPanel.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Graham Cox

 On 26 Mar 2015, at 10:57 pm, Dave d...@looktowindward.com wrote:
 
 i tried this just to get something working for now, but it doesn’t seem to 
 affect where the Alert is displayed.
 
 myAlert = [NSAlert alertWithMessageText:@Do you really want to do that? 
 defaultButton:@“No alternateButton:@“Yes otherButton:nil 
 informativeTextWithFormat:@It might cause mayhem!”];
 
 myAlertWindow = myAlert.window;
 myAlertWindowFrameRect = myAlertWindow.frame;
 myAlertWindowFrameRect.origin = myNewOrigin;
 [myAlertWindow setFrame:myAlertWindowFrameRect display:YES];
 
 myAlertResponse = [myAlert runModal];
 if (myAlertResponse == kDialogResponseYes)
   {
   }
 else
   {
   }
 



At the point you're setting the frame, the window isn't visible. -runModal 
shows the window if necessary and positions it on screen, overriding the frame 
you set. If you force it to be visible before -runModal is called, the frame 
position you set is not changed. This works:


NSAlert* alert = [NSAlert alertWithMessageText:@hello 
defaultButton:@ok alternateButton:@cancel otherButton:nil 
informativeTextWithFormat:@bing bang wallah wallah bang];

[alert.window setFrameOrigin:NSMakePoint( 10, 100)];
[alert.window makeKeyAndOrderFront:nil];

NSInteger result = [alert runModal];


NSLog(@response = %ld, result);


 I’ll investigate doing it using a sheet next week, but it would be nice to 
 have the Alert working in the meantime.


Your requirement isn't clear - do you want a sheet to appear as if unattached 
to a host window, just floating in space? Even if you can achieve it, users 
will simply assume your app is buggy. Ideas like this are never seen in the 
wild for good reason.

--Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Shane Stanley
On 27 Mar 2015, at 10:45 am, Quincey Morris 
quinceymor...@rivergatesoftware.com wrote:
 
 AFAIK custom sheet positioning is basically never done. (And I don’t know 
 that you can force custom positioning on a NSAlert sheet.)

FWIW, you can -- I do it. (Think of a deep-ish document window divided into top 
and bottom sections, and the user is doing stuff in the bottom part -- it makes 
more sense, it seems to me, to have the alert appear from the top of the bottom 
view than at the top of the window.)

-- 
Shane Stanley sstan...@myriad-com.com.au
www.macosxautomation.com/applescript/apps/


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread Scott Ribe
On Mar 26, 2015, at 7:08 PM, Shane Stanley sstan...@myriad-com.com.au wrote:
 
 FWIW, you can -- I do it. (Think of a deep-ish document window divided into 
 top and bottom sections, and the user is doing stuff in the bottom part -- it 
 makes more sense, it seems to me, to have the alert appear from the top of 
 the bottom view than at the top of the window.)

I do it too. Be warned, starting with Mavericks things went wacko-batshit 
stupid if the sheet is near the screen bounds...

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice






___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com