home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
rwdlg3.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1997-07-29
|
2KB
|
85 lines
/*
Program which uses tests dialog resources with grouped controls
*/
#include <owl\applicat.h>
#include <owl\framewin.h>
#include <owl\dialog.h>
#include "rwdlg3.h"
// declare the custom application class as
// a subclass of TApplication
class TWinApp : public TApplication
{
public:
TWinApp() : TApplication() {}
protected:
virtual void InitMainWindow();
};
// expand the functionality of TWindow by deriving class TMainWindow
class TMainWindow : public TWindow
{
public:
TMainWindow() : TWindow(0, 0, 0) {}
protected:
// handle the Find menu option
void CMFind();
// handle the Replace menu option
void CMReplace();
// handle confirming closing the window
virtual BOOL CanClose();
// declare the response table
DECLARE_RESPONSE_TABLE(TMainWindow);
};
DEFINE_RESPONSE_TABLE1(TMainWindow, TWindow)
EV_COMMAND(CM_FIND, CMFind),
EV_COMMAND(CM_REPLACE, CMReplace),
END_RESPONSE_TABLE;
void TMainWindow::CMFind()
{
TDialog* pDlg = new TDialog(this, TResId(IDD_FIND_DLG));
pDlg->Execute();
}
void TMainWindow::CMReplace()
{
TDialog* pDlg = new TDialog(this, TResId(IDD_REPLACE_DLG));
pDlg->Execute();
}
BOOL TMainWindow::CanClose()
{
return MessageBox("Want to close this application?",
"Query", MB_YESNO | MB_ICONQUESTION) == IDYES;
}
void TWinApp::InitMainWindow()
{
MainWindow = new TFrameWindow(0,
"Grouped Controls Tester",
new TMainWindow);
// load the menu resource
MainWindow->AssignMenu(TResId(EXITMENU));
EnableBWCC(); // Enable Borland controls
}
int OwlMain(int /* argc */, char** /*argv[] */)
{
TWinApp app;
return app.Run();
}