Why Doesnt This Work

Why Wont It display my text gadget if u know how to fix it please post it here. according to borlands examples it should work i dont get it!
#include <owl/floatfra.h>
#include <owl/textgadg.h>
#include <owl/pch.h>
#include <owl/applicat.h>
#include <owl/framewin.h>
#include <owl/gdiobjec.h>
#include <owl/pictwind.h>
#include "pictwind.rh"
#include <owl/static.h>

TTextGadget* TextGadget;
const char* Picture = "darthmon.bmp";

class TSampleApp : public TApplication {
  public:
    TSampleApp()
    {
      CurrentHow = TPictureWindow::Center;
    }

    void InitMainWindow();

    void CmFeed()
    {}
    void CmPlay()
    {}
    void CmClean()
    {}
    void CmKill()
    {}

    void CmNormal(){
      CurrentHow = TPictureWindow::Center;
      NewClient(TPictureWindow::Center);
    }
    void CmFullScreen () {
      CurrentHow = TPictureWindow::Stretch;
      NewClient(TPictureWindow::Stretch);
    }
    void NewClient(TPictureWindow::TDisplayHow how);

  private:

  TPictureWindow::TDisplayHow CurrentHow;

  DECLARE_RESPONSE_TABLE(TSampleApp);
};

DEFINE_RESPONSE_TABLE1(TSampleApp, TApplication)
  EV_COMMAND       (CM_FEED,    CmFeed),
  EV_COMMAND       (CM_PLAY, CmPlay),
  EV_COMMAND       (CM_CLEAN,   CmClean),
  EV_COMMAND       (CM_KILL,   CmKill),
  EV_COMMAND       (CM_NORMAL,   CmNormal),
  EV_COMMAND       (CM_FULLSCREEN,   CmFullScreen),
END_RESPONSE_TABLE;



void TSampleApp::NewClient(TPictureWindow::TDisplayHow how)
{
  TWindow* cw = new TPictureWindow(0, new TDib(Picture), how);
  cw->Attr.ExStyle |= WS_EX_CLIENTEDGE;

  TWindow* oldClient = GetMainWindow()->SetClientWindow(cw);

  delete oldClient;
}

void
TSampleApp::InitMainWindow()
{

  TWindow* cw = new TPictureWindow(0, new TDib(Picture), TPictureWindow::Center);
  cw->Attr.ExStyle |= WS_EX_CLIENTEDGE;

  TextGadget =  new TTextGadget(0, TGadget::Recessed, TTextGadget::Left, 8);  //Why                                                                                                 //Wont This WORK
  *TextGadget;
  TextGadget->SetText("PRINT ME!!!");

  // create main window
  //
  SetMainWindow(new TFrameWindow(0, "DarthMon",cw));
  GetMainWindow()->AssignMenu(IDM_MAINMENU);
  }

int
OwlMain(int /*argc*/, char* /*argv*/[])
{
  return TSampleApp().Run();
}
LVL 1
ziggy_9mmAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexVirochovskyCommented:
For display Gadget you must add it in ContolBar. Example:

  ControlBar = new TControlBar(frame);
  ......
  TextGadget = new TTextGadget(0, TGadget::Recessed, TTextGadget::Left, 8);
  TextGadget->SetText("PRINT ME");
  ControlBar->Insert(*TextGadget);
  TextGadget->SetEnabled(false);
  ......
Alex
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ziggy_9mmAuthor Commented:
opps i seem to have made a mistake in what i posted i  ment to display a text box, is it similar, sorry for the wait.
0
AlexVirochovskyCommented:
>>display a text box, is it similar?
Text box in what situation? Can you
send more detailes or snippet of you
code?
BTW: If you mean Static Text Control, use function SetWindowText.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

ziggy_9mmAuthor Commented:
The code i have is posted above all i want to do is put a text box in. like a visual basic text box. my code compliles but it doesnt display the box, the code above is the code is just the basic skeleton of the program that displays a picture and below it i want to have a text box like the one im typing in right now. thanx.
0
AlexVirochovskyCommented:
Instead of TTextGadget you must use tStatic contol. Next is you example:
#include <owl/floatfra.h>
#include <owl/textgadg.h>
#include <owl/pch.h>
#include <owl/applicat.h>
#include <owl/framewin.h>
#include <owl/gdiobjec.h>
#include <owl/pictwind.h>
#include "ziggi.rh"
#include <owl/static.h>

TStatic * tText;
const char* Picture = "darthmon.bmp";

class TSampleApp : public TApplication {
  public:
    TSampleApp()
    {
      CurrentHow = TPictureWindow::Center;
    }

    void InitMainWindow();

    void CmFeed()
    {}
    void CmPlay()
    {}
    void CmClean()
    {}
    void CmKill()
    {}

    void CmNormal(){
      CurrentHow = TPictureWindow::Center;
      NewClient(TPictureWindow::Center);
    }
    void CmFullScreen () {
      CurrentHow = TPictureWindow::Stretch;
      NewClient(TPictureWindow::Stretch);
    }
    void NewClient(TPictureWindow::TDisplayHow how);

  private:

  TPictureWindow::TDisplayHow CurrentHow;

  DECLARE_RESPONSE_TABLE(TSampleApp);
};

DEFINE_RESPONSE_TABLE1(TSampleApp, TApplication)
  EV_COMMAND       (CM_FEED,     CmFeed),
END_RESPONSE_TABLE;



void TSampleApp::NewClient(TPictureWindow::TDisplayHow how)
{
  TWindow* cw = new TPictureWindow(0, new TDib(Picture), how);
  cw->Attr.ExStyle |= WS_EX_CLIENTEDGE;

  TWindow* oldClient = GetMainWindow()->SetClientWindow(cw);

  delete oldClient;
}

void
TSampleApp::InitMainWindow()
{

  TWindow* cw = new TPictureWindow(0, new TDib(Picture), TPictureWindow::Center);
  cw->Attr.ExStyle |= WS_EX_CLIENTEDGE;


  // create main window
  //
  SetMainWindow(new TFrameWindow(0, "DarthMon",cw));
  GetMainWindow()->AssignMenu(IDM_MAINMENU);
  tText =  new TStatic(GetMainWindow(),-1, "PRINT ME!!!",10, 10,100,16);
}

int
OwlMain(int /*argc*/, char* /*argv*/[])
{
  return TSampleApp().Run();
}
0
ziggy_9mmAuthor Commented:
Thanxs A lot it works great, is it just me or have u answered all my questions.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.