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

📄 uinotifycontainer.cpp

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

#include "UI_Button.h"
#include "DBNotify.h"

enum {
	ID_TZ_BASE	= ID_XXX_BASE + 560,

	ID_BTN_DELETE	= ID_TZ_BASE + 1,
};

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

//##ModelId=3D64A509030C
void UINotifyContainer::Show()
{
	m_UINotifyContent.Show();
	ControlDrawControl(ID_BTN_DELETE);
	//ControlDrawControl(ID_MAIN_RETURN);
	DrawReturnButton();
}

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

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

	return bHandled;
}

//##ModelId=3D552DB702E4
Err UINotifyContainer::Initialize()
{
	DBNotify theDBNotify;
	NotifyContent content;

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