关于类,请大侠指教
muzhi 2004-04-30 11:21:56 #ifndef CONTROL_H
#define CONTROL_H
#include "Cursor.h"
class CEdit : public CObject
{
protected:
const BYTE m_MaxLen; // 最大输入的范围
const BYTE m_MinLen; // 最小输入的范围
const bool m_bIsPas; // 是否加密显示
BYTE m_Maxcur; // 在框内最多显示的字符数量
BYTE m_Pos; // 光标所在的字符位,0开始
BYTE m_Start; // 第一个显示的字符位,0开始
bool m_bSet; // 修改标记
border m_Border;
CUrsor * Cursor; // 光标
virtual int ProKey(int); // 基本键处理
public:
bool auto_end;
friend class CUrsor; // 友元光标类
CEdit(string & Text,int x,int y,int w,int h,CWindow * WIN=NULL);
CEdit(string & Text,CRect & R,CWindow * WIN=NULL);
virtual ~CEdit();
virtual bool GetFocus();
virtual bool LoseFocus();
virtual void Paint();
virtual int KeyEdit(); // 编辑事件
virtual bool DoModify() // 修改事件
{ m_bSet = false; return true; }
};
#endif
#ifndef CURSOR_H_
#define CURSOR_H_
#include "Control.h"
class CEdit;
extern possys *allsys;
class CUrsor
{
protected:
BYTE cur; // 光标当前位置
bool visible; // 光标显示状态
CEdit * E_Handle; // 单行编辑框指针
public:
CUrsor(CEdit *Handle, BYTE Cur=0, bool Visible=false)
: E_Handle(Handle), cur(Cur), visible(Visible)
{ if(visible) Display(); }
/*** 移动光标 */
void Move(const int Cur)
{
// 超过文本范围判断
if(Cur >= 0 && Cur < E_Handle->m_Maxcur)
{
BYTE oldvisible = visible;
Remove();
cur = Cur;
if(oldvisible) Display();
}
}
};
void CUrsor::Display()
{
setfillstyle(SOLID_FILL, WHITE);
int loc = cur * 8;
int Y = E_Handle->m_iTop + (E_Handle->GetHeight() -16) /2 ;
bar(E_Handle->m_iLeft+loc+2,Y-1,E_Handle->m_iLeft + loc + 9 ,Y + 17);
if(E_Handle->m_Start + cur < E_Handle->m_sText.length())
{
char ch[2] = { 0, 0 };
if(E_Handle->m_bIsPas) ch[0] = '*';
else
ch[0] = E_Handle->m_sText.get_at(E_Handle->m_Start+cur);
allsys->hzk.outtext(E_Handle->m_iLeft + loc + 2,Y,E_Handle-m_Color,ch);
}
visible = true;
}
#endif
错误显示:
Error:Cursor.h(31,3):'m_Maxcur' is not a member of 'CEdit'
Error:Cursor.h(77,26):'m_iTop' is not a member of 'CEdit'
Error:Cursor.h(77,50):'GetHeight' is not a member of 'CEdit'
Error:Cursor.h(79,23):'m_iLeft' is not a member of 'CEdit'
Error:Cursor.h(79,58):'m_iLeft' is not a member of 'CEdit'
Error:Cursor.h(81,22):'m_Start' is not a member of 'CEdit'
Error:Cursor.h(81,48):'m_sText' is not a member of 'CEdit'
Error:Cursor.h(84,25):'m_bIsPas' is not a member of 'CEdit'
Error:Cursor.h(87,29):'m_sText' is not a member of 'CEdit'
Error:Cursor.h(87,54):'m_Start' is not a member of 'CEdit'
Error:Cursor.h(89,40):'m_iLeft' is not a member of 'CEdit'
Error:Cursor.h(89,71):'m_Color' is not a member of 'CEdit'
Warn :Cursor.h(93,2):'loc' is assigned a value that is never used
请问怎么解决,是哪里的问题,编译环境borland c++5.0