- UID
- 181
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-10
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
在一显示的树上编辑时, 有一个项改名的问题: 如点击某一接线, 如发电机功率P<10000KW, 出现
-----------------------
|发电机功率P<10000KW |
-----------------------
修改为:
-----------------------
|发电机功率P>10000KW |
-----------------------
但点击其他项时, 还是发电机功率P<10000KW, 为什么改不过来?
谢谢!
接线
[] 接线1
| |发电机1台
| |电路1回
|
[] 接线2
| |发电机1台
| |电路2回
|
[] 接线3
| |发电机2台
| |线路1回
| |发电机功率P<10000KW
|
|
|
代码如下:
// MyExam07Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "MyExam07Dlg.h"
#include "exam07.h"
#define ATTRIB_SIZE 80
struct attribute
{
char attrib[ATTRIB_SIZE];
attribute *next;
}at;
#define NAME_SIZE 80
struct object
{
char name[NAME_SIZE];
attribute *alist;
};
#define MAX 1024
struct object k_base[MAX];
struct attribute *p;
int l_pos=-1;
int r_pos=-1;
void clear_kbase()
{
int t;
struct attribute *p,*p2;
for (t=0;t<l_pos;t++) {
p=k_base[t].alist;
while (p) {
p2=p->next;
free(p);
p=p2;
}
}
}
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
MyExam07Dlg::MyExam07Dlg(CWnd* pParent /*=NULL*/)
: CAcUiDialog(MyExam07Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(MyExam07Dlg)
//}}AFX_DATA_INIT
}
void MyExam07Dlg::DoDataExchange(CDataExchange* pDX)
{
CAcUiDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MyExam07Dlg)
DDX_Control(pDX, ARXDBG_TR_SYS_REG, m_tv);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MyExam07Dlg, CAcUiDialog)
//{{AFX_MSG_MAP(MyExam07Dlg)
ON_NOTIFY(NM_RCLICK, ARXDBG_TR_SYS_REG, OnRclickTrSysReg)
ON_NOTIFY(TVN_BEGINLABELEDIT, ARXDBG_TR_SYS_REG, OnBeginlabeleditTrSysReg)
ON_NOTIFY(TVN_ENDLABELEDIT, ARXDBG_TR_SYS_REG, OnEndlabeleditTrSysReg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// MyExam07Dlg message handlers
BOOL MyExam07Dlg::OnInitDialog()
{
SetDialogName("exam07:MyExam07Dlg");
CAcUiDialog::OnInitDialog();
DLGCTLINFO dlgSizeInfo[]= {
{ IDC_STATIC_GROUP1, ELASTICX, 20 },
{ IDC_STATIC_GROUP1, ELASTICY, 100 },
{ IDC_LIST_BLOCKS, MOVEX, 20 },
{ IDC_LIST_BLOCKS, ELASTICY, 100 },
{ IDC_LIST_BLOCKS, ELASTICX, 80 },
{ IDC_COMBO_REGAPPS, MOVEY, 100 },
{ IDC_COMBO_REGAPPS, ELASTICX, 20 },
};
int t,x;
struct attribute *p,*oldp;
FILE *fp;
if ((fp=fopen("expert.dat","r"))==0) {
acutPrintf("找不到文件");
return TRUE;
}
acutPrintf("装入内存\n");
clear_kbase();
t=0;
HTREEITEM noderoot,nodeson,nodeson1;
noderoot=m_tv.InsertItem("root");
for (;;++t) {
if ((k_base[t].name[0]=getc(fp))==0) break;
for (x=1;x<=sizeof(k_base[t].name);x++)
k_base[t].name[x]=getc(fp);
k_base[t].alist=(struct attribute *)malloc(sizeof(at));
p=k_base[t].alist;
nodeson=m_tv.InsertItem (k_base[t].name, noderoot);
if (!p) {
return TRUE;
}
for (;;) {
for (x=0;x<sizeof(p->attrib);x++) p->attrib[x]=getc(fp);
nodeson1=m_tv.InsertItem (p->attrib, nodeson);
if (!p->attrib[0]) {
oldp->next='\0';
break;
}
p->next=(struct attribute *)malloc(sizeof(at));
if (!p->next) {
break;
}
oldp=p;
p=p->next;
}
}
fclose(fp);
l_pos=t-1;
//return t-1;
//DisplayRegApps();
return TRUE;
}
void MyExam07Dlg::OnOK()
{
CAcUiDialog::OnOK();
}
void MyExam07Dlg::OnRclickTrSysReg(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CMenu menu;
//CAcModuleResourceOverride(ArxDbgApp::getApp()->dllInstance());
CPoint point;
if (menu.LoadMenu(ARXDBG_MNU_OBJSET)) {
CMenu* pContextMenu = menu.GetSubMenu(0);
if (pContextMenu) {
ClientToScreen(&point);
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, point.x, point.y, this);
return;
}
}
*pResult = 0;
}
void MyExam07Dlg::OnBeginlabeleditTrSysReg(NMHDR* pNMHDR, LRESULT* pResult)
{
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
// TODO: Add your control notification handler code here
acutPrintf("begin");
*pResult = 0;
}
void MyExam07Dlg::OnEndlabeleditTrSysReg(NMHDR* pNMHDR, LRESULT* pResult)
{
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
// TODO: Add your control notification handler code here
int t,x;
struct attribute *p;
FILE *fp;
if ((fp=fopen("expert.dat","w"))==0) {
printf("cannot open file \n");
return;
}
acutPrintf("Saving knowledge base. \n");
for (t=0;t<=l_pos;++t) {
for (x=0;x<=sizeof(k_base[t].name);x++)
putc(k_base[t].name[x],fp);
p=k_base[t].alist;
while (p) {
for (x=0;x<sizeof(p->attrib);x++)
putc(p->attrib[x],fp);
p=p->next;
}
for (x=0;x<sizeof(p->attrib);x++) putc('\0',fp);
}
putc(0,fp);
fclose(fp);
*pResult = 0;
} |
|