VS 2008 MFC功能包-我该如何 [英] VS 2008 MFC Feature Pack - How do I

查看:107
本文介绍了VS 2008 MFC功能包-我该如何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用MFC Feature Pack编写的应用程序.它使用文档/视图.由于这些类是从常规" MFC类派生的,因此这些问题可能不是特定于Feature Pack的.

I have an application I'm writing using the MFC Feature pack. It uses Document/View. Since these classes are derived from "normal" MFC classes, these questions may not be Feature Pack specific.

进行更改后,我使用以下代码在选项卡上的名称中添加星号*,并在主窗口标题中添加单词(modified):

When a change is made, I add an asterisk * to the name on the tab, and the word (modified) to the main window title using the following code:

tabval = "Report_" + pDoc->rptData.reportId.Strip();
winval = tabval;
if (changed) {
    tabval += " *";
    winval += " (modified)";
}
frame->SetTitle(tabval);
frame->SetWindowText(tabval);
name = mainFrame->GetTitle();
mainFrame->SetWindowText(name + " - " + winval);

但是在选项卡之间切换时,原始文本会返回.第一个问题:如何使更改保持粘性?

But when changing between tabs, the original text comes back. First question: how do I make the change sticky?

第二个问题:左侧是树状视图,右侧是属性窗口.在它们之间切换(取消)会突出显示标题栏,以显示哪个是活动的.用户还可以激活文档窗口并与之交互,但是似乎没有任何方法可以提供视觉反馈,表明文档窗口实际上是活动的.我该怎么办?

Second question: there's a tree view on the left and a properties window on the right. Switching between them (un)highlights the title bars to show which one is active. The user can also activate and interact with the document window, but there doesn't seem to be any way to give visual feedback that the document window is, in fact, active. How can I do that?

推荐答案

尚不清楚您的变量是什么类型,但是由于您有pDocframe,我假设前者是您的CDocument派生类,后者可能是CFrameWndCMDIFrameWnd派生类.

It's not clear what types your variables are, but as you have pDoc and frame, I'm assuming that the former is your CDocument derived class and the latter is possibly a CFrameWnd or CMDIFrameWnd derived class.

如果我没错,那么选项卡标题没有固定的原因是您应该在每个选项卡式视图后面的CDocument上调用SetTitle,所以类似

If I'm not far wrong, then the reason why the tab titles aren't sticking is that you should be calling SetTitle on the CDocument that's behind each tabbed view, so something like

tabval = "Report_" + pDoc->rptData.reportId.Strip();
winval = tabval;
if (changed) {
    tabval += " *";
    winval += " (modified)";
}
pDoc->SetTitle(tabval);    // set tab title on CDocument

这篇关于VS 2008 MFC功能包-我该如何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆