{"id":1782,"date":"2004-10-20T15:22:02","date_gmt":"2004-10-20T14:22:02","guid":{"rendered":"https:\/\/yvespeneveyre8e29bf869d.wordpress.com\/2004\/10\/20\/ne-pas-utiliser-runmodalforwindow-do-not-use-runmodalforwindow\/"},"modified":"2004-10-20T15:22:02","modified_gmt":"2004-10-20T14:22:02","slug":"ne-pas-utiliser-runmodalforwindow-do-not-use-runmodalforwindow","status":"publish","type":"post","link":"https:\/\/www.peneveyre.com\/en\/2004\/10\/20\/ne-pas-utiliser-runmodalforwindow-do-not-use-runmodalforwindow\/","title":{"rendered":"Ne pas utiliser runModalForWindow: &#8211; Do not use runModalForWindow"},"content":{"rendered":"<p><P>Dans une nib, vous avez une fen&#234;tre (NSWindow) et un panel (NSPanel), par exemple. Maintenant, dans la m&#233;thode awakeFromNib vous &#233;crivez :<\/P><br \/>\n<BLOCKQUOTE dir=\"ltr\"><br \/>\n<P>&#8211; (void) awakeFromNib<BR>{<BR>[NSApp runModalForWindow: mainPanel];<BR>NSLog(@&#8221;%s&#8221;, __PRETTY_FUNCTION__);<BR>}<\/P><\/BLOCKQUOTE><br \/>\n<P>Si votre fen&#234;tre poss&#232;de l&#8217;attribut &#8220;Visible at launch time&#8221;, celle-ci ne risque pas de s&#8217;afficher tant que le panel ne sera pas ferm&#233;. Ceci car awakeFromNib est la premi&#232;re m&#233;thode appel&#233;e&#8230; De m&#234;me si vous tentez de modifier le menu, il n&#8217;appara&#238;tra pas. Logique me direz-vous, mais il faut y penser ! <\/P><br \/>\n<P><EM>In your nib file you have a NSWindow and a NSPanel. Now write the following code :<\/EM><\/P><br \/>\n<P><EM>&#8211; (void) awakeFromNib<BR>{<BR>[NSApp runModalForWindow: mainPanel];<BR>NSLog(@&#8221;%s&#8221;, __PRETTY_FUNCTION__);<BR>}<\/EM><\/P><br \/>\n<P><EM>If you window has the &#8220;Visible at launch time&#8221; attribute set, that window will not display until the panel is not dismissed. This is because awakeFromNib is called first before all other methods&#8230; We will have the same behavior if you try to change the application menu at run-time. That menu will not display.<\/EM><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>De retour ?? programmer sous MacOS X, je me suis fais pi??ger par le principe de la modalit?? d&#8217;une fen??tre.<br \/>\nBack working under MacOS X, I fall into a trap related to modal windows<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1782","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/posts\/1782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/comments?post=1782"}],"version-history":[{"count":0,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/posts\/1782\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/media?parent=1782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/categories?post=1782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/tags?post=1782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}