Solved

Using Dialog as a Main Window

Posted on 1998-05-19
2
214 Views
Last Modified: 2013-12-26
Hi..great idea!Just found this site.
Anyway , I'm a novice just fumbling my way through OWL using TurboC++ & OWL 2.5 to learn.
My question is:
I want to use a dialog box as the main window.
I prepared the dialog box in the resource editor as I have for other dialog and used this as the main window (TFrameWindow & TDialog client).
It displays on the screen as it should but HOW do I communicate with the controls???
Only have 3 TStatic (used to display relevant data AFTER a file is opened) and a TEdit box for user input.
What approach should I be taking to communicate with these controls??
Txs.
0
Comment
Question by:dooley090698
2 Comments
 
LVL 3

Accepted Solution

by:
msmits earned 50 total points
ID: 1299680
You should use a TMyDialog class that is derived from TDialog and uses the IDD_ value for your Resource Editor designed dialog as parameter for the constructor.
In the TMyDialog class you can create the objects for your controls like TStatic and TEdit. Then you can communicate with them.

TStatic *my_info_1 = new TStatic(this, IDS_MYINFO1);
TEdit *my_edit = new TEdit(this, IDE_MYEDIT, ...);

my_info_1->SetText("Hello");
etc.

For reacting to events you need message maps and eventhandler functions.
0
 

Expert Comment

by:kollipara
ID: 1299681
#include <owl\owlpch.h>

Hi dooley this may help you :

First declare a class of type TDialog with members as the controls which you want when the dialog comes up as shown below:

class TDialogWindow : public TDialog
{
 public:
  TDialogWindow() :
       TDialog(0, 1)
  { StaticText = new
            TStatic(this, 101);
      EditText = new
            TEdit(this, 102);}
 protected:
  TStatic* StaticText;
  TEdit* EditText;

 
  void DoEditText()
  { //
     StaticText->SetText("Hello")
     //This is  an  example function in which you can do what            //ever processing you want
 }

  DECLARE_RESPONSE_TABLE(TDialogWindow);
};

DEFINE_RESPONSE_TABLE1(TDialogWindow, TDialog)
 EV_EN_CHANGE(102, DoEditText),
END_RESPONSE_TABLE;

class DialogApplication : public TApplication
{
 public:
  void InitMainWindow()
  { BOOL ShrinkToClient = TRUE;
       SetMainWindow(new TFrameWindow(0,
            "Example Main Dialog",
            new TDialogWindow(),
            ShrinkToClient));
       GetMainWindow()->Attr.Style &=
            ~(WS_THICKFRAME | WS_MAXIMIZEBOX);
  }
};

int OwlMain(int, char**)
{ return DialogApplication().Run(); }
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question