Solved

Using Dialog as a Main Window

Posted on 1998-05-19
2
215 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

756 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