NSMenu 显示/隐藏 HUD NSPanel 的问题

发布于 2024-08-22 03:28:58 字数 1291 浏览 1 评论 0原文

对于这个问题仍然有很大的困难。有什么建议吗?

我无法在网上找到一个简单的教程来解释 NSPanel 窗口与 NSWindow 不同的基础知识。

我有一个 HUD 窗口,我想将其显示为通知和消息输入框,但我无法弄清楚如何进行。我的尝试如下。

我知道这是一个措辞不当且过于宽泛的问题;作为 Objective C 和 Interface Builder 的新手,我还没有足够的经验来进行更具体的说明。

在相关部分:AppController.h

@interface AppController : NSObject {

    IBOutlet NSMenu *statusMenu;
    IBOutlet id HUDPanel;


    IBOutlet NSTextField *HUDTextField;
    IBOutlet NSTextField *HUDLabel;
    IBOutlet NSProgressIndicator *HUDSpinner;

    NSStatusItem *statusItem;
    NSImage *statusImage;
    NSImage *statusHighlightImage;  

}


- (IBAction)recognizeCurrentLocation:(id)sender;

- (IBAction)saveButtonPressed:(id)sender; 

- (IBAction)newLocationMenuItem:(id)sender; 

- (IBAction)HUDPanelHide:(id)sender;

- (IBAction)HUDPanelShow:(id)sender;



@end

在相关部分:AppController.c

- (IBAction)HUDPanelHide:(id)sender{
    [HUDPanel close];
}

- (IBAction)HUDPanelShow:(id)sender{
    [HUDPanel makeKeyAndOrderFront:self];
}

我相当确定我在 IB 中的链接是正确的 - 我按照教程设置了大部分内容,并且我分配给其他操作的菜单项是正确的执行。

我找到的教程在这里:

http://www.mataderu.com/xphere /info/cocoa_tut02/OpenGLrules.zip

Still having great difficulty with this problem. Any suggestions?

I cannot find a simple tutorial online that explains the basics of NSPanel windowing as different from NSWindow.

I have an HUD window that I'd like to show as a notification & input box, but I cannot for the life of me figure out how. My attempts are below.

I know this is a poorly phrased and overly broad question; being new to Objective C and Interface Builder, I do not quite yet have my feet wet enough to be more specific.

In relevant part: AppController.h

@interface AppController : NSObject {

    IBOutlet NSMenu *statusMenu;
    IBOutlet id HUDPanel;


    IBOutlet NSTextField *HUDTextField;
    IBOutlet NSTextField *HUDLabel;
    IBOutlet NSProgressIndicator *HUDSpinner;

    NSStatusItem *statusItem;
    NSImage *statusImage;
    NSImage *statusHighlightImage;  

}


- (IBAction)recognizeCurrentLocation:(id)sender;

- (IBAction)saveButtonPressed:(id)sender; 

- (IBAction)newLocationMenuItem:(id)sender; 

- (IBAction)HUDPanelHide:(id)sender;

- (IBAction)HUDPanelShow:(id)sender;



@end

In relevant part: AppController.c

- (IBAction)HUDPanelHide:(id)sender{
    [HUDPanel close];
}

- (IBAction)HUDPanelShow:(id)sender{
    [HUDPanel makeKeyAndOrderFront:self];
}

And I am fairly sure that my linking in IB is correct - I followed a tutorial to set most of this up, and menu items that I have assigned to other actions are properly executing.

The tutorial I found was here:

http://www.mataderu.com/xphere/info/cocoa_tut02/OpenGLrules.zip

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

知你几分 2024-08-29 03:28:58

显然我的答案是我没有创建“实用程序窗口” - 例如我有一个 *.xib 而不是 *.nib 文件。

我不确定为什么这会产生影响,所以也许专家的更多解释在这里值得注意。

否则,我的代码正是它应该的样子。

Apparently my answer was that I was not creating a "utility window" - e.g. I had an *.xib instead of a *.nib file.

I'm not sure why this makes a difference so perhaps more explanation from an expert would be worth noting here.

Otherwise, my code was exactly what it should be.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文