Skip to content

Commit

Permalink
模态窗口使用例子
Browse files Browse the repository at this point in the history
  • Loading branch information
Troy committed Aug 28, 2015
1 parent a927a83 commit 4d514a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
14 changes: 10 additions & 4 deletions Demos/duidemo/MainWnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ class CDemoFrame : public WindowImplBase, public CWebBrowserEventHandler, public
{
if( msg.pSender == m_pCloseBtn )
{
PostQuitMessage(0);
if(IDYES == MessageBox(NULL, _T("确定退出duidemo演示程序?"), _T("Duilib旗舰版"), MB_YESNO))
{
PostQuitMessage(0);
}
return;
}
else if( msg.pSender == m_pMinBtn ) {
Expand Down Expand Up @@ -181,13 +184,16 @@ class CDemoFrame : public WindowImplBase, public CWebBrowserEventHandler, public
}
else if(sName.CompareNoCase(_T("popwnd_btn")) == 0)
{
if( m_pPopWnd == NULL )
if(m_pPopWnd == NULL)
{
m_pPopWnd = new CPopWnd();
m_pPopWnd->Create(NULL, _T("透明窗口演示"), WS_POPUP | WS_VISIBLE, 0L, 0, 0, 800, 572);
}
if(!::IsWindow(*m_pPopWnd))
{
m_pPopWnd->Create(m_hWnd, _T("透明窗口演示"), WS_POPUP | WS_VISIBLE, 0L, 0, 0, 800, 572);
}
m_pPopWnd->CenterWindow();
::ShowWindow(*m_pPopWnd, SW_SHOW);
m_pPopWnd->ShowModal();
}
else if(sName.CompareNoCase(_T("qqgroup_btn")) == 0)
{
Expand Down
10 changes: 1 addition & 9 deletions Demos/duidemo/PopWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ CPopWnd::~CPopWnd(void)
void CPopWnd::OnFinalMessage( HWND hWnd)
{
__super::OnFinalMessage(hWnd);
delete this;
}

DuiLib::CDuiString CPopWnd::GetSkinFolder()
Expand Down Expand Up @@ -55,7 +54,7 @@ void CPopWnd::OnClick( TNotifyUI &msg )
sName.MakeLower();

if( msg.pSender == m_pCloseBtn ) {
ShowWindow(false);
Close(0);
return;
}
else if( msg.pSender == m_pMinBtn ) {
Expand Down Expand Up @@ -87,13 +86,6 @@ void CPopWnd::OnItemSelect( TNotifyUI &msg )

LRESULT CPopWnd::HandleCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// 关闭窗口,退出程序
if(uMsg == WM_DESTROY)
{
::PostQuitMessage(0L);
bHandled = TRUE;
return 0;
}
bHandled = FALSE;
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions bin/skin/duidemo/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
<VerticalLayout >
<Control />
<HorizontalLayout height="30" childpadding="12">
<Button name="popwnd_btn" text="弹出窗口" textcolor="#FF555555" normalimage="res='button_normal.png' corner='4,4,4,4'" hotimage="res='button_hover.png' corner='4,4,4,4'" pushedimage="res='button_pushed.png' corner='4,4,4,4'" width="100"/>
<Button name="qq_btn" text="问题咨询" textcolor="#FF555555" normalimage="res='button_normal.png' corner='4,4,4,4'" hotimage="res='button_hover.png' corner='4,4,4,4'" pushedimage="res='button_pushed.png' corner='4,4,4,4'" width="100"/>
<Button name="popwnd_btn" text="模态弹出窗口" textcolor="#FF555555" normalimage="res='button_normal.png' corner='4,4,4,4'" hotimage="res='button_hover.png' corner='4,4,4,4'" pushedimage="res='button_pushed.png' corner='4,4,4,4'" width="100"/>
<Button name="qq_btn" text="问题咨询(&Q)" shortcut="Q" textcolor="#FF555555" normalimage="res='button_normal.png' corner='4,4,4,4'" hotimage="res='button_hover.png' corner='4,4,4,4'" pushedimage="res='button_pushed.png' corner='4,4,4,4'" width="100"/>
</HorizontalLayout>
<Control />
</VerticalLayout>
Expand Down

0 comments on commit 4d514a8

Please sign in to comment.