Re: gtk-list digest, Vol 1 #66 - 11 msgs



> 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.
> 
> 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?
> 
> Thanks for your help.
> 
> 
> FILE *OpenPrinter(void)
> {
>   FILE *printer=NULL;
>   if((printer=fopen(PRINTER_DEV,"w"))==NULL)
>     {
>     fprintf(stderr,"Impossible d'ouvrir le port imprimante !\n");
> 	    exit(2); 
>      }
>     
>   return(printer);
> }
> 
> 
> 
> Marc Raeymaekers
> Laboratoire de Biologie clinique
> C.H.F. Rabelais
> Brussels
> Belgium
> 

I am also a newbie, but i think i would do as follows under your case.

convert your fprintf's to sprintf with another standard string defined
locally. or one can define a global string pointer just to use as a
scratch pad.

make a new standard function which will take a string and will display a
dialog box of a fixed type. for making a dialog box, you can use the
standard gtk function called gtk_dialog_new() which returns a GtkWidget.

this widget also contains a struture element called action_area, basically
an hbox, in which you can pack buttons. and the callback of the button
active state can be attached to the funtion for closing the application or
may be to a perticular job to finish.

look more about dialog boxes in the Gtk Tutorial and in the GtkRefernece
source. I think the problem is tractable. 


Dipan Mehta.








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