home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
yacl-012.zip
/
uidemo
/
dialog2
/
appwin.cxx
next >
Wrap
C/C++ Source or Header
|
1995-04-08
|
2KB
|
95 lines
#include "ui/orbtngrp.h"
#include "ui/xrbtngrp.h"
#include "ui/pushbtn.h"
#include "ui/label.h"
#include "ui/stred.h"
#include "ui/dialog.h"
#include "ui/applic.h"
#include "appwin.h"
#include "ids.h"
UI_ViewDescriptor desc[] = {
{View_PushButton, ID_START, 0, 0, 60, 30, TRUE, "Start"},
{View_PushButton, ID_QUIT, 0, 60, 60, 30, TRUE, "Quit"},
{View_None, -1, 0, 0, 0, 0, 0, 0}
};
UI_DialogEventDescriptor desc2 [] = {
ID_OK, Event_Select,
ID_CANCEL, Event_Select,
-1, Event_None
};
AppWindow::AppWindow ()
: UI_CompositeVObject (NULL, desc, FALSE, UI_Rectangle (50, 50, 500, 400))
{
msg = new UI_Label (this, UI_Rectangle (10, 100, 340, 250));
msg->Font().PointSize(10);
_title = "YACL Dialog Demo";
}
extern FAR UI_ViewDescriptor DLG_DIALOG_1_Item[];
extern FAR UI_RectangleStruct DLG_DIALOG_1_Shape;
#if defined(__MS_WINDOWS__)
#define END_OF_LINE "\r\n"
#else
#define END_OF_LINE "\n"
#endif
bool AppWindow::HandleChildEvent(const UI_Event& e)
{
UI_CompositeVObject::HandleChildEvent (e);
if( e.Origin()->ViewID() == ID_QUIT && e.Type()== Event_Select) {
_Application->End();
return FALSE;
}
if (e.Origin()->ViewID() != ID_START || e.Type() != Event_Select)
return FALSE;
UI_Dialog* d = new UI_Dialog (this, DLG_DIALOG_1_Item,
DLG_DIALOG_1_Shape, desc2);
d->Title() = "Inner dialog";
CL_String& stred_data = (CL_String &) ((*d) [ID_FILENAME])->Model();
stred_data = "File.txt";
CL_String& msg_value = (CL_String &) (msg->Model());
msg_value = "";
UI_OrButtonGroup& grp = *(UI_OrButtonGroup*) (*d)[ID_PERMS];
grp[ID_READ]->Model() = CL_Integer (1);
// Now execute the dialog modally
UI_ViewID quitID = d->ExecuteModal ().id;
// Retrieve its contents
CL_IntPtrMapIterator itr ((CL_IntPtrMap &) (d->Model()) );
itr.Reset();
while (itr.More()) {
CL_IntPtrAssoc assoc = itr.Next();
UI_ViewID id = assoc.key;
msg_value += "Id " + CL_String (id)
+ " value: " + assoc.value->AsString() + END_OF_LINE;
}
msg_value += "Quit button Id: " + CL_String (quitID)
+ END_OF_LINE;
// Get rid of the dialog
_Application->Destroy (d);
return TRUE;
}