FLTK logo

Re: [fltk/fltk] Fl::run returns immediately when Fl_Window is wrapped in a PIMPL class (#275)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] Fl::run returns immediately when Fl_Window is wrapped in a PIMPL class (#275) Albrecht Schlosser Sep 27, 2021  
 

@Neur1n One more note: your code was incomplete (missing headers, constructors, destructors) and there were some typos. I wonder how this code could compile. If you ask further questions in fltk.general, please try to post complete, compileable code so we can better help you.

I converted your files so I could compile the entire program with fltk-config --compile main.cpp:

// file: main.cpp
#include "app.h"

int main() {
  App app(400, 300, "APP");
  return Fl::run();
}
// file: app.h
#include <FL/Fl_Window.H>

class AppImpl {
public:
  AppImpl(int w, int h, const char *title) {
    this->m_win = new Fl_Window(w, h, title);
    this->m_win->show();
  }
  ~AppImpl() {
    if (this->m_win) {
      delete this->m_win;
      this->m_win = nullptr;
    }
  }
private:
  Fl_Window *m_win;
};

class App {
public:
  App(int w, int h, const char *title) { m_impl = new AppImpl(w, h, title); }
  ~App(){};

private:
  AppImpl *m_impl;
};

Hope this helps.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.