home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tybc4
/
bug.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-26
|
2KB
|
92 lines
#include <stdio.h>
#include <windows.h>
#include <owl\applicat.h>
#include <owl\dialog.h>
#include <owl\framewin.h>
#include <owl\listbox.h>
#include <owl\window.h>
#include <owl\window.rh>
class TMyDialog : public TDialog
{
public:
TMyDialog(TWindow *parent, TModule *module = 0);
void SetupWindow();
private:
TListBox *numbers;
};
TMyDialog::TMyDialog(TWindow *parent, TModule *module)
: TDialog(parent, "TheDialog", module)
{
}
void fill_lb(TListBox *plb, int count)
{
for (int ix = 0; ix < count; ++count)
{
char str[25];
sprintf(str, "%d", ix + 1);
plb->AddString(str);
}
}
void TMyDialog::SetupWindow()
{
fill_lb(numbers, 20);
}
class TMyWindow : public TWindow
{
public:
TMyWindow(TWindow *parent = 0);
protected:
void CmExit();
void CmDialog();
private:
DECLARE_RESPONSE_TABLE(TMyWindow);
};
DEFINE_RESPONSE_TABLE1(TMyWindow, TWindow)
EV_COMMAND(CM_EXIT, CmExit),
EV_COMMAND(100, CmDialog),
END_RESPONSE_TABLE;
TMyWindow::TMyWindow(TWindow *parent)
: TWindow(parent)
{
}
void TMyWindow::CmExit()
{
SendMessage(WM_CLOSE);
}
void TMyWindow::CmDialog()
{
TMyDialog(this).Execute();
}
class TDialogApp : public TApplication
{
public:
TDialogApp() : TApplication()
{ nCmdShow = SW_SHOWMAXIMIZED; }
void InitMainWindow()
{
SetMainWindow(new TFrameWindow( 0,
"Dialog Testers, Inc.",
new TMyWindow ));
GetMainWindow()->AssignMenu("MainMenu");
}
};
int OwlMain(int, char *[])
{
return TDialogApp().Run();
}