RE: dialog widget



> hello everybody,
> 
> I've developped a little application for my job (in a medical 
> lab): to print barcodes on a thermal
> transfert printer. The initial version was in text mode and 
> worked fine, but my collegues had
> preferences for a graphical version. Then I learn gtk+.
> The graphical one works well since sept.99, but it cannot 
> display error messages.

You should take a look at the GLib logging functions. Take a look at
http://developer.gnome.org/doc/API/glib/glib-warnings-and-assertions.html
and http://developer.gnome.org/doc/API/glib/glib-message-logging.html.
It's all in there!

> I think to add a dialog box created by a C function. But how 
> to do to connect it in the if
> statement. All the documentation about the dialog widget 
> mentions the gtk_signal_connect().
> It's fine when the event  parameter is a clicked button or 
> so. It's certainly simple to resolve,
> but I'm a newbie in gtk+ programming. 
> 
> Thus, how replace the fprintf() function by a dialog window?

Don't use it! Use the GLib functions instead!

> Thanks for your help.
> 
> 
> FILE *OpenPrinter(void)
> {
>   FILE *printer=NULL;
>   if((printer=fopen(PRINTER_DEV,"w"))==NULL)
>     {

Replace:
>     fprintf(stderr,"Impossible d'ouvrir le port imprimante !\n");
> 	    exit(2); 
by:
	g_error ("Impossible d'ouvrir le port imprimante !\n");

>      }
>     
>   return(printer);
> }
> 

Regards,

Arjan




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