ew_filedialog.cpp
来自「基于Windml2.0的窗口系统原代码 , 以及和MFC CDC兼容的CDC」· C++ 代码 · 共 53 行
CPP
53 行
#include "stdio.h"
#include "EW_FileDialog.h"
#include "cemgis.h"
#include "EW_MessageBox.h"
BEGIN_MESSAGE_MAP(EW_FileDialog, EW_Window)
// ON_KEYDOWN (EW_Window::OnKeyDown)
ON_ID_NOTIFY (FBN_PRESSED, ID_OK, EW_FileDialog::OnOK)
ON_ID_NOTIFY (FBN_PRESSED, ID_CANCEL, EW_FileDialog::OnCancel)
END_MESSAGE_MAP()
EW_FileDialog::EW_FileDialog(int xPos , int yPos , WORD wID):EW_Window("打开文件", wID, FS_RAISED)
{
m_Rect.Set(xPos , yPos , xPos + 400 , yPos + 80);
EW_Factory * pF = EW_GetFactory();
AddWidget(pF->CreateButton("OK(O)", EW_Rect(xPos + 235 , yPos + 55 , xPos + 315 , yPos + 75) , ID_OK));
AddWidget(pF->CreateButton("Cancel(C)", EW_Rect(xPos + 315 , yPos + 55 , xPos + 395 , yPos + 75) , ID_CANCEL));
AddWidget(pF->CreateLabel("File Name:", EW_Rect(xPos + 5 , yPos + 30 , xPos + 85 , yPos + 50)));
AddWidget(pF->CreateEdit("", EW_Rect(xPos + 85 , yPos + 30 , xPos + 395 , yPos + 50), 35, ID_EDIT1));
RegisterKey('O', FVK_ENTER, ID_OK);
RegisterKey('C', FVK_ENTER, ID_CANCEL);
}
EW_FileDialog::~EW_FileDialog()
{
}
void EW_FileDialog::OnOK()
{
CEMGIS *pEMGIS = GetCEMGIS();
EW_Edit * pEdit = (EW_Edit *)GetChild(ID_EDIT1);
if(pEdit->TextLength() != 0){
if(pEMGIS->OpenVXWLayer(pEdit->GetText()) != false)
EW_GetScreen()->RemoveWindow(this);
else{
char strMsg[1024];
sprintf(strMsg , "Open Layer(%s) failed!" , pEdit->GetText());
EW_MessageBox *pMessageBox = new EW_MessageBox(m_Rect.wLeft + 100 , m_Rect.wTop + 100 , strMsg);
EW_GetScreen()->AddWindow(pMessageBox);
}
}
}
void EW_FileDialog::OnCancel()
{
EW_GetScreen()->RemoveWindow(this);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?