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  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 



___

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  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

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 
 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 



___

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  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
 


> 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: Display an Alert Sheet at a Specified Screen Position

2015-03-26 Thread dangerwillrobinsondanger



> On 2015/03/27, at 9:10, Graham Cox  wrote:
> 
> 
>> On 27 Mar 2015, at 10:45 am, Quincey Morris 
>>  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 Graham Cox

> On 27 Mar 2015, at 10:45 am, Quincey Morris 
>  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 Quincey Morris
On Mar 26, 2015, at 16:00 , Graham Cox  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  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 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-25 Thread Mike Abdullah
Are you perhaps looking for this API? 
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSWindowDelegate_Protocol/index.html#//apple_ref/occ/intfm/NSWindowDelegate/window:willPositionSheet:usingRect:

> On 25 Mar 2015, at 22:06, Dave  wrote:
> 
> Hi All,
> 
> I’d like to be able to display and Model Alert Sheet at an arbitrary screen 
> location, is this possible?
> 
> If not, if I created a borderless window with a transparent content area and 
> positioned it where I wanted it, could I then display the Sheet using this 
> window using [alert beginSheetModalForWindow:[searchField window] 
> modalDelegate:self 
> didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) 
> contextInfo:nil]; ?
> 
> I’d like to be able to display and Model Alert Sheet at an arbitrary screen 
> location, is this possible?
> 
> Thanks in advance.
> All the Best
> 
> 
> 
> 
> ___
> 
> 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/mabdullah%40karelia.com
> 
> This email sent to mabdul...@karelia.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-25 Thread Graham Cox

> On 26 Mar 2015, at 9:06 am, Dave  wrote:
> 
> I’d like to be able to display and Model Alert Sheet at an arbitrary screen 
> location, is this possible?


It's not possible because by definition a sheet is attached to another window.

You can position a non-sheet modal alert anywhere through its -window property.

--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-25 Thread edward taffel
use a borderless window, init w/ zero height, and animate the show for 
requisite frame height.

> On Mar 25, 2015, at 6:06 PM, Dave  wrote:
> 
> Hi All,
> 
> I’d like to be able to display and Model Alert Sheet at an arbitrary screen 
> location, is this possible?
> 
> If not, if I created a borderless window with a transparent content area and 
> positioned it where I wanted it, could I then display the Sheet using this 
> window using [alert beginSheetModalForWindow:[searchField window] 
> modalDelegate:self 
> didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) 
> contextInfo:nil]; ?
> 
> I’d like to be able to display and Model Alert Sheet at an arbitrary screen 
> location, is this possible?
> 
> Thanks in advance.
> All the Best
> 
> 
> 
> 
> ___
> 
> 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/etaffel%40me.com
> 
> This email sent to etaf...@me.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