Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using Dialog as a Main Window

Posted on 1998-05-19
2
Medium Priority
?
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
msmits earned 100 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

Industry Leaders: 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

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…
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.
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…
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…

670 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