Regarding Changing Background Color of the Window



Dear All,

My name is Deepak, I have created a GUI using Glade 3.20. I want to change the background color of the window. I am using GTKMM 3.0. I accessed the widgets using derived classes. I attached the code what I did. I am getting errors. I am new to C++ and GTKMM. Please help me regarding this. Required libraries are included

int main (int argc, char **argv)
{

  auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example");

  //Load the Glade file and instantiate its widgets:
  auto refBuilder = Gtk::Builder::create();

  try
  {
    refBuilder->add_from_file("Functional_GUI1.glade");
  }
  catch(const Glib::FileError& ex)
  {
    std::cerr << "FileError: " << ex.what() << std::endl;
    return 1;
  }
  catch(const Glib::MarkupError& ex)
  {
    std::cerr << "MarkupError: " << ex.what() << std::endl;
    return 1;
  }
  catch(const Gtk::BuilderError& ex)
  {
    std::cerr << "BuilderError: " << ex.what() << std::endl;
    return 1;
  }

  //Get the GtkBuilder-instantiated dialog:
   mainWindow* pWindow = nullptr;
   Control_panel* pControl = nullptr;

   refBuilder->get_widget_derived("Functional_Testing", pWindow);
   refBuilder->get_widget_derived("Panel_Grid", pControl);

   pWindow->set_title("SKANRAY PRODUCTS");
pWindow->override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(.5,.5,.5,.5));

  if(pWindow)
  {
    app->run(*pWindow);
  }

  delete pWindow;

  return 0;

}

Thanks
Deepak
HARVEL Systems



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]