#include <owl\applicat.h> #include <owl\checkbox.h> #include <owl\dc.h> #include <owl\framewin.h> #include <owl\owlpch.h> #include <owl\eventhan.h> #include <owl\combobox.h> #include <owl\checkbox.h> #include <owl\edit.h> #include <stdio.h> class TBufferApp : public TApplication { public: TBufferApp() {} ~TBufferApp() {} void InitMainWindow() { TFrameWindow* frame = new TFrameWindow( 0, "TRNSBUF2.EXE"); frame->AssignMenu(1); SetMainWindow( frame ); } void Dialog(); DECLARE_RESPONSE_TABLE(TBufferApp); }; DEFINE_RESPONSE_TABLE1(TBufferApp,TApplication) EV_COMMAND(101,Dialog), END_RESPONSE_TABLE; struct MyDialogBuffer { char edText[20]; TComboBoxData lbData; WORD cbData; char stText[20]; }; class MyDialog : public TDialog { public: MyDialog(TWindow* parent, int resID) : TDialog(parent, resID), TWindow(parent) { new TEdit(this, 1100, 20); new TComboBox(this, 1200, 20); new TCheckBox(this, 1300); TStatic* st = new TStatic(this, 1400, 20); st->EnableTransfer(); } }; void TBufferApp::Dialog() { MyDialogBuffer buf; strcpy(buf.edText, "Initial Text"); buf.lbData.AddStringItem("Item 1", 800); buf.lbData.AddStringItem("Item 2", 433); buf.lbData.AddStringItem("Item 3", 223); buf.cbData = BF_GRAYED; strcpy(buf.stText, "Static Text"); MyDialog* d = new MyDialog(GetMainWindow(), 1000); d->SetTransferBuffer(&buf); while(d->Execute() == IDOK) { char temp[128]; int idx = buf.lbData.GetSelIndex(); int itemID = (int)buf.lbData.GetItemDatas()[idx]; const char* itemText = buf.lbData.GetSelection().c_str(); sprintf(temp, "Text = %s \n" "Combo Box = %s (ID)%d item #%d \n" "Check Box = %d \n" "Static Text = %s", buf.edText, itemText, itemID, idx, buf.cbData, buf.stText); GetMainWindow()->MessageBox(temp, "Transfer Data"); strcpy(buf.stText, buf.edText); } d->Destroy(); } int OwlMain(int, char**) { return TBufferApp().Run(); }
Copyright (c) 1996 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Publishing Company.