[haiku-appserver] help

  • From: Adi Oanca <adioanca@xxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Fri, 18 Mar 2005 19:40:35 +0200

Hi guys,


        I have a big, BIG problem with app_server.
        I can't find the reason why I get thrown into debugger when clicking 
"ZTestWindow1". If you can help, please help!

here's the TestApp code:

#include <OS.h>
#include <Application.h>
#include <Window.h>
#include <View.h>
#include <Rect.h>
#include <Point.h>
#include <stdio.h>

const int32             offset = 0;

class MyView : public BView
{
public:
                                                        MyView(BRect, const 
char*, uint32, uint32);
        virtual void                    MouseDown(BPoint point);
        virtual void                    KeyDown(const char* bytes, int32 
numBytes);
        virtual void                    KeyUp(const char* bytes, int32 
numBytes);
        virtual void                    MouseUp(BPoint point);
};

class MyApp : public BApplication
{
public:
        MyApp(void);
};

class MyWin : public BWindow
{
public:
                                        MyWin(BRect rect, const char *name, 
window_look look, window_feel
feel, uint32 flags);
        virtual void    MessageReceived(BMessage *message);
private:
        MyView                  *view;
};

MyView::MyView(BRect rect, const char* name, uint32 rm, uint32 flags)
        : BView(rect, name, rm, flags)
{
}

void MyView::MouseDown(BPoint point)
{
        printf("Mouse Down: %f, %f\n", point.x, point.y);
}

void MyView::MouseUp(BPoint point)
{
        printf("Mouse UP: %f, %f\n", point.x, point.y);
}

void MyView::KeyDown(const char* bytes, int32 numBytes)
{
        printf("Key Down: %c\n", bytes[0]);
}

void MyView::KeyUp(const char* bytes, int32 numBytes)
{
        printf("Key UP: %c\n", bytes[0]);
}


MyWin::MyWin(BRect rect, const char *name, window_look look, window_feel
feel, uint32 flags)
        : BWindow(rect, name, look, feel, flags)
{
        rgb_color       c;
        c.red           = 23;
        c.green         = 59;
        c.blue          = 124;
        c.alpha         = 255;
        view = new MyView(BRect(50,20, 150,80),"bla", B_FOLLOW_NONE, B_WILL_DRAW
| B_NAVIGABLE);
        view->SetViewColor(c);
        AddChild(view);
}

void MyWin::MessageReceived(BMessage *message)
{
        BWindow::MessageReceived(message);
}

MyApp::MyApp(void)
  : BApplication("application/x-vnd.wgp-OBTestApp")
{
printf("Adi: MyApp\n");
        MyWin *win=new
         
MyWin(BRect(offset+100,100,offset+300,200),"ZTestWindow1",B_DOCUMENT_WINDOW_LOOK,
                B_NORMAL_WINDOW_FEEL,0);
        win->Show();

        MyWin *win1=new
         
MyWin(BRect(offset+200,250,offset+400,350),"ZTestWindow2",B_DOCUMENT_WINDOW_LOOK,
                B_NORMAL_WINDOW_FEEL,0);
        win1->Show();

        MyWin *win2=new
         
MyWin(BRect(offset+400,100,offset+600,200),"ZTestWindow3",B_DOCUMENT_WINDOW_LOOK,
                        B_FLOATING_APP_WINDOW_FEEL, 0);
        win2->Show();

        MyWin *win3=new
         
MyWin(BRect(offset+400,300,offset+600,400),"ZTestWindow4",B_DOCUMENT_WINDOW_LOOK,
                        B_FLOATING_SUBSET_WINDOW_FEEL, 0);
        win3->Show();

        win3->AddToSubset(win);
}

int main(void)
{
        MyApp app;
        app.Run();
}




Other related posts: