⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uipersoncontainer.cpp

📁 嵌入式系统PDA的流程
💻 CPP
字号:
#include "UIPersonContainer.h"

#include "UI_Button.h"
#include "DBPersonInfo.h"

enum {
	ID_GRXX_BASE	= ID_XXX_BASE + 920,

	ID_BTN_DELETE	= ID_GRXX_BASE + 1,
};

UIPersonContainer::UIPersonContainer(SHORT iRecID)
:m_iRecID(iRecID)
{
}

//##ModelId=3D64A509030C
void UIPersonContainer::Show()
{
	m_UIPersonContent.Show();
	ControlDrawControl(ID_BTN_DELETE);
	DrawReturnButton ();
}

//##ModelId=3D64A50503CF
Err UIPersonContainer::OnDeleteBtn()
{
	DBPersonInfo theDBPersonInfo;
	theDBPersonInfo.OpenTable(EMDB_RDWR);
	theDBPersonInfo.DelRec(m_iRecID);
	theDBPersonInfo.CloseTable();
	//return to previous view
	OnReturnClick();
	return SUC;
}

//##ModelId=3D64A5140254
BOOLEAN UIPersonContainer::HandleEvent(EvtType* pEvent)
{
	BOOLEAN bHandled = FALSE;
	switch (pEvent->eventType)
	{
	case EVT_CONTROL_SELECT:
			switch (pEvent->eventID)
			{
			case ID_BTN_DELETE:
				OnDeleteBtn();
				bHandled = TRUE;
				break;
			case ID_MAIN_RETURN:
				OnReturnClick();//derived from UISectionCenter
				bHandled = TRUE;
				break;
			}
	}
	if (!bHandled)
		bHandled = m_UIPersonContent.HandleEvent(pEvent);

	return bHandled;
}

//##ModelId=3D552DB702E4
Err UIPersonContainer::Initialize()
{
	DBPersonInfo theDBPersonInfo;
	PersonContent content;

	//create content area
	theDBPersonInfo.OpenTable(EMDB_RDONLY);
	theDBPersonInfo.GetContent(m_iRecID, &content);
	theDBPersonInfo.CloseTable();
	m_UIPersonContent.SetContent(&content);
	m_UIPersonContent.Initialize();
	//create delete button
	UI_ButtonInit(ID_BTN_DELETE,
					88, 160-SECTIONDOWN_HEIGHT-15-2,//x,y
					15, 30,//height,width
					(BYTE*)"删除",//name
					PDAXWT_FORM);
	ControlSetAttributes(ID_BTN_DELETE, TRUE,FALSE,FALSE,TRUE,TRUE);
	//create return button
	UISectionCenter::CreateUIObjects();

	return SUC;
}

//##ModelId=3D64A5230364
Err UIPersonContainer::DestroyWindow()
{
	//delete content area
	m_UIPersonContent.DestroyWindow();

	//ControlEraseControl(ID_BTN_DELETE);
	UI_FormDeleteObject(ID_BTN_DELETE, PDAXWT_FORM);
	//delete return button
	UISectionCenter::DestroyUIObjects();

	return SUC;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -