RE: Gtk::MessageDialog



Hi,

 

It doesnât make sense to use the manage() (widget life-cycle) function because a Gtk::MessagDialog has no parent container. Itâs like a Gtk::Window...

 

I recommend you this way to instantiate your MessageDialog into your UIException constructor :

 

// declaration jit

Gtk::MessageDialog MyExceptionMessageDialog( *this,

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ âMy message,,,,â,

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂFalse /*use markup*/,

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ÂÂÂÂÂ Gtk::MESSAGE_QUESTION,

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ Gtk::BUTTONS_OK_CANCEL

ÂÂÂÂÂ ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ);

MyExceptionMessageDialog.set_secondary_text(âonce upon a time ...â); // just for illustration

MyExceptionMessageDialog.run(); // start the message dialog

Int response = MyExceptionMessageDialog.run() // capture the user action

std::cout<<((response == Gtk::RESPONSE_OK) ? âyou pressed OKâ : âyou pressed cancelâ)<<std::endl;

 

 

Marco Dos Santos Oliveira

EBU/European Broadcasting Union

Technology and Innovation Department

 

From: gtkmm-list [mailto:gtkmm-list-bounces gnome org] On Behalf Of Doesnt Stop
Sent: jeudi 14 fÃvrier 2013 11:27
To: Gtkmm List
Subject: Gtk::MessageDialog
Importance: High

 

I am trying to create a gui interface for my Exception class, but I am getting some

errors from GTKmm library, this is the error message:

1>------ Build starte[drive:] Project: vsApp, Configuration: Debug Win32 ------
1>  vsApp.cpp
1>  uiexception.cpp
1>[drive:]\gtkmm\include\pango-1.0\pango\pango-utils.h(34): error C2065: 'stream' :

undeclared identifier
1>[drive:]\gtkmm\include\pango-1.0\pango\pango-utils.h(35): error C2065: 'str' :

undeclared identifier
1>[drive:]\gtkmm\include\pango-1.0\pango\pango-utils.h(35): error C2275: 'GString' :

illegal use of this type as an _expression_
1>          [drive:]\gtkmm\include\glib-2.0\glib\gstring.h(40) : see declaration of

'GString'
1>[drive:]\gtkmm\include\pango-1.0\pango\pango-utils.h(35): error C2078: too many

initializers
1>  exception.cpp
1>  Generating Code...
========== Buil[drive:] 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Earlier I was hit a wall like the one I am hitting now, but soldatov cleared things up when informed me that, since I am using VS10, I need to add this line in the main.cpp
int main( int argc, char **argv );
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine,int nCmdShow){
return main (__argc, __argv);
}

Now, could this problem be because I need to add other code than the one used in the examples? This is the code:

uiexception.hpp
~~~~~~~~~~~~~~~~
#ifndef UIEXCEPTION_HPP
#define UIEXCEPTION_HPP

#include "../../exception/exception.hpp"
#include <gtkmm/messagedialog.h> //<-- remove

namespace ns{
 class uiexception : virtual public Exception{
 public:
  uiexception();
  virtual ~uiexception()throw(){}
 private:
  Gtk::MessageDialog* dialog; //<-- remove
 };
}

#endif
--------------------------

uiexception.cpp
~~~~~~~~~~~~~~~
#ifndef UIEXCEPTION_HPP
#include "uiexception.hpp"
#endif

ns::uiexception::uiexception(){
 dialog = Gtk::manage(new Gtk::MessageDialog(
 " message",  //Message
 false, // Markup
 Gtk::MESSAGE_WARNING, //MessageType
 Gtk::BUTTONS_OK,      //Buttons
 false));               //modal
}

what could be causing this error messages?


**************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error, please notify the system manager. This footnote also confirms that this email message has been swept by the mailgateway
**************************************************



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