[Gambas-user] Gambas3 Printing

Michael mdavies5 at ...169...
Fri Dec 3 13:51:25 CET 2010


Does anybody have any experience of printing with Gambas3?
My sample code is below and the result is:
Calling .Configure fires the _End event.
Then the _Begin, _Paginate and _Draw events all fire.
Then I get an error "(Test:4193): Gtk-CRITICAL **: 
IA__gtk_print_context_get_cairo_context: assertion `GTK_IS_PRINT_CONTEXT 
(context)' failed"
Then a blank page is printed.
I have tried the sample Print app supplied with Gambas 3 but it was 
written for Gambas1. I'm surprised it even loaded. I cannot find much 
help on the net.
Would appreciate any help.
(Running on Ubuntu 10.10 with gb.gtk and gb.Cairo components).
Regards
Michael

Public myP As New Printer As "myP"
Public Sub Menu2_Click()
    Dim blnOk As Boolean
    If Not myP.Configure() Then
          blnok = myP.Print()
         Paint.Begin(myP)
     Endif
     Catch
         Message.Error(Error.Text)
End
Public Sub myP_Begin()
     myP.count = 1
End
Public Sub myP_Draw()
         Paint.Brush = Paint.Color(Color.Black)
         Paint.Font.Name = "sans serif"
         Paint.Font.Size = 16
         Paint.Text("hello", 300, 300, 600,, Align.Right)
         Paint.End
End
Public Sub myp_End()
    Debug "PRINT END"
End
Public Sub myp_Paginate()
     Debug "Paginate"
End





More information about the User mailing list