Solved

Using Dialog as a Main Window

Posted on 1998-05-19
2
212 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
Comment Utility
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
Comment Utility
#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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

763 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now