Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using Dialog as a Main Window

Posted on 1998-05-19
2
Medium Priority
?
219 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 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

Independent Software Vendors: 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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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…
Suggested Courses

885 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