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

📄 uiusercontainer.cpp

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

#include "UI_Button.h"
#include "DBUserInfo.h"

enum {
	ID_YHZL_BASE	= ID_XXX_BASE + 650,

	ID_BTN_DELETE	= ID_YHZL_BASE + 1,
};

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

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

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

//##ModelId=3D64A5140254
BOOLEAN UIUserContainer::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_UIUserContent.HandleEvent(pEvent);

	return bHandled;
}

//##ModelId=3D552DB702E4
Err UIUserContainer::Initialize()
{
	DBUserInfo theDBUserInfo;
	UserContent content;

	//create content area
	theDBUserInfo.OpenTable(EMDB_RDONLY);
	theDBUserInfo.GetContent(m_iRecID, &content);
	theDBUserInfo.CloseTable();
	m_UIUserContent.SetContent(&content);
	m_UIUserContent.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 UIUserContainer::DestroyWindow()
{
	//delete content area
	m_UIUserContent.DestroyWindow();

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

	return SUC;
}

⌨️ 快捷键说明

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