[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Why Doesnt This Work

Posted on 1999-12-20
6
Medium Priority
?
236 Views
Last Modified: 2013-12-26
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();
}
0
Comment
Question by:ziggy_9mm
  • 3
  • 3
6 Comments
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 400 total points
ID: 2298239
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
 
LVL 1

Author Comment

by:ziggy_9mm
ID: 2306195
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
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2306303
>>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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
LVL 1

Author Comment

by:ziggy_9mm
ID: 2308799
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
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2309477
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
 
LVL 1

Author Comment

by:ziggy_9mm
ID: 2316198
Thanxs A lot it works great, is it just me or have u answered all my questions.
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

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 …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

590 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