Empty Fl_Window?

This is a discussion on Empty Fl_Window? within the C++ Programming forums, part of the General Programming Boards category; Hi, I made a GUI for my project a few months ago and it worked fine. I left it alone ...

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    117

    Empty Fl_Window?

    Hi,

    I made a GUI for my project a few months ago and it worked fine. I left it alone for a few months and then went back to add to it. But now the window is empty. I have a class called GUIWindow that is a subclass of Fl_Window and I put widgets on it in the constructor. Then in main I just call the constructor and return Fl::run(). The code I have is -

    GUIWindow constructor -

    Code:
    GUIWindow::GUIWindow(Robot& r) : Fl_Window(500, 400, "iRobot Create"), robot(&r) {
        begin();    //make the widgets, button for each option
    
            fullMode = new Fl_Button(25, 300, 90, 30, "Full Mode");
            fullMode->when(FL_WHEN_RELEASE);
            fullMode->callback(cb_fullmode, this);
            fullMode->shortcut('f');
    
            safeMode = new Fl_Button(25, 350, 90, 30, "Safe Mode");
            safeMode->when(FL_WHEN_RELEASE);
            safeMode->callback(cb_safemode, this);
            safeMode->shortcut('s');
            velocity = new Fl_Input(230, 25, 50, 30, "Velocity");
    
            drive = new Fl_Button(25, 75, 70, 30, "Drive");
            drive->when(FL_WHEN_RELEASE);
            drive->callback(cb_drive, this);
            drive->shortcut('d');
    
            driveRadius = new Fl_Input(150, 75, 50, 30, "Radius");
    
            turn = new Fl_Button(300, 75, 60, 30, "Turn");
            turn->when(FL_WHEN_RELEASE);
            turn->callback(cb_turn, this);
            turn->shortcut('t');
    
            //more widgets...
    
        end();  //end making widgets
        robot->fullMode();
        robot->streamSensors();
        Fl::add_idle(IdleCallback, this);
        resizable(this);
        show(); //show it
    
    }

    in main -

    Code:
            Robot robot(robot_port, ROBOT_BAUDRATE, direction[0]);
            GUIWindow window(robot);
            return Fl::run();

    Whenever I run, the window comes up and the idle callback works, but the window has no widgets and it closes if I click in it.

    I don't think this is an issue, but I made it using Ubuntu and now I'm using Debian.

    I tried a basic example from the web and it works. And I can't see what is that much different from my code.

    Code:
    void but_cb( Fl_Widget* o, void*  ) {
       Fl_Button* b=(Fl_Button*)o;
       b->label("Good job"); //redraw not necessary
    
       b->resize(10,150,140,30); //redraw needed
       b->redraw();
    }
    
    int main() {
            Fl_Window win( 300,200,"Testing" );
            win.begin();
               Fl_Button but( 10, 150, 70, 30, "Click me" );
            win.end();
            but.callback( but_cb );
            win.show();
            return Fl::run();
    }
    If anyone can help me see whats going wrong here I would be grateful.

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Cupertino
    Posts
    2,589
    The exact same code shows a blank window ?
    Then report a bug.
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    117
    Would I be filing the bug with Debian or FLTK?

  4. #4
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Cupertino
    Posts
    2,589
    Start by identifying whose problem this is, possibly by posting on the relevant forums(I'd say fltk.... maybe there is a version difference ?).
    Manasij Mukherjee | gcc-4.9.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. empty
    By KIBO in forum C++ Programming
    Replies: 15
    Last Post: 04-10-2011, 06:09 AM
  2. Empty #define
    By noops in forum C Programming
    Replies: 2
    Last Post: 07-25-2008, 11:22 AM
  3. Empty Array?
    By Terran in forum C++ Programming
    Replies: 2
    Last Post: 06-16-2008, 12:47 AM
  4. empty constructors?
    By paperbox005 in forum C++ Programming
    Replies: 2
    Last Post: 08-19-2004, 07:05 AM
  5. .empty()
    By minesweeper in forum C++ Programming
    Replies: 1
    Last Post: 12-07-2002, 05:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21