Re: Error converting from UTF8 to ISO-8859-1



Herewith I sent the complete code of the .adb file that I have made.
I have seen before I tried to connect the buttons that the creation of the
dialog works. The the close button (right above) destroys the dialog than.
I use the Windows version of GPS 2009 x6-windows and GtkADA which came along
with it in the beginning of july 2009.

with Glib; use Glib;
with Gtk; use Gtk;
with Gdk.Types; use Gdk.Types;
with Gtk.Widget; use Gtk.Widget;
with Gtk.Window; use Gtk.Window;
with Gtk.Enums; use Gtk.Enums;
with Gtk.Button; use Gtk.Button;
with Gtk.Color_Selection; use Gtk.Color_Selection;
with Gtk.Handlers; use Gtk.Handlers;
with Gtkada.Handlers; use Gtkada.Handlers;
with Callbacks_Escape; use Callbacks_Escape;
with Escape_Intl; use Escape_Intl;
--with Escape_Pkg.Callbacks; use Escape_Pkg.Callbacks;

package body Wall_Color_Pkg is

package Button_Callback is new Gtk.Handlers.User_Callback
(Gtk_Button_Record, Gtk_Window);

procedure On_WallFloorOK_Activate(Object : access
GTK_Button_Record'Class) is
begin
null;
end;

procedure Gtk_New (Wall_Color : out Wall_Color_Access) is
begin
Wall_Color := new Wall_Color_Record;
Wall_Color_Pkg.Initialize (Wall_Color);
end Gtk_New;

procedure Initialize (Wall_Color : access Wall_Color_Record'Class) is
pragma Suppress (All_Checks);
Pixmaps_Dir : constant String := "pixmaps/";
ColorSelection : Gtk_Color_Selection;
OK : Gtk_Button;
Cancel : Gtk_Button;
Help : Gtk_Button;
begin
Gtk.Color_Selection_Dialog.Initialize (Wall_Color, -"Wall Color");
Set_Border_Width (Wall_Color, 5);
Set_Title (Wall_Color, -"Wall Color");
Set_Position (Wall_Color, Win_Pos_None);
Set_Modal (Wall_Color, False);
Set_Resizable (Wall_Color, False);
ColorSelection := Get_ColorSel (Wall_Color );
OK := Get_OK_Button (Wall_Color);
Cancel := Get_Cancel_Button (Wall_Color);
Help := Get_Help_Button (Wall_Color);
Set_Current_Color( ColorSelection, Current_Color );
Button_CallBack.Connect(OK, "clicked",
On_WallFloorOK_Activate'Access);


end Initialize;

procedure Set_Wall_Color( Red : in Guint16; Green : in Guint16; Blue : in
Guint16 ) is
begin
Set_Rgb(Current_Color, Red, Green, Blue);
end;

end Wall_Color_Pkg;

"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> schreef in bericht
news:8isqph858n0s$.krle17w7i2z1$.dlg@xxxxxxxxxxxxx
On Wed, 29 Jul 2009 17:11:35 +0200, ldries46 wrote:

I suddenly got the error mentioned in the title.
I am trying to connect a "clicked" signal from a button in a dialog to a
routine that executes some function. The code I have so far for the
Initialize routine of the dialog is:

procedure Initialize (Wall_Color : access Wall_Color_Record'Class) is
pragma Suppress (All_Checks);
Pixmaps_Dir : constant String := "pixmaps/";
ColorSelection : Gtk_Color_Selection;
OK : Gtk_Button;
Cancel : Gtk_Button;
Help : Gtk_Button;
begin
Gtk.Color_Selection_Dialog.Initialize (Wall_Color, -"Wall Color");
Set_Border_Width (Wall_Color, 5);
Set_Title (Wall_Color, -"Wall Color");
Set_Position (Wall_Color, Win_Pos_None);
Set_Modal (Wall_Color, False);
Set_Resizable (Wall_Color, False);
ColorSelection := Get_ColorSel (Wall_Color );
OK := Get_OK_Button (Wall_Color);
Cancel := Get_Cancel_Button (Wall_Color);
Help := Get_Help_Button (Wall_Color);
Set_Current_Color( ColorSelection, Current_Color );
Button_CallBack.Connect(OK, "clicked",
On_WallFloorOK_Activate'Access);
end Initialize;
When I outcomment the line Button.Connect etc. the package with this
function compiles without errors. Once the line is also compiled I get
the
error when opened always on the lines 37:0, 38:0 and 39:0 with the
descriprion Invalid byte sequence in conversion input. In this case these
lines are:
Help : Gtk_Button;
begin
Gtk.Color_Selection_Dialog.Initialize (Wall_Color, -"Wall Color");
but when I add multiple lines comments or code for instance on line 20
etc.
the line nr's of the error stay the same 37, 38 and 39.
I now cannot search further to solve my connect problem.

You should post a complete code.

Also never suppress checks, at least until production code.

P.S. I remotely remember that in some version of GtkAda the color
selection
dialog didn't work, but I might be wrong. You could consider switching to
Gtk_Color_Selection.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


.



Relevant Pages

  • Re: Extending existing methods of base classes and Loose Methods.
    ... So I changed the class definition and changed the class method ... initialize. ... this changes to my package. ... the package scripts are a good place for this. ...
    (comp.lang.smalltalk.dolphin)
  • Re: Types, packages & objects : the good old naming conventions question (without religious ware
    ... there is in Ada, no separate name spaces for type names and instance ... is in most of case used to initialize it. ... the sole purpose to avoid a naming clash, ends up in a legal source, ... Packaging and package name prefix may help here (coming with a name ...
    (comp.lang.ada)
  • Re: passing a Factory to a method to create a generic instance
    ... IOStream ios = new FileIOStream; ... a.assignmentLoadis supposed to initialize the object, completely, from the data read from ios. ... Read a token from the stream, associate that token with a class, instantiate the class with newInstance. ... >> constructors, then make the factory object part of the package, so it ...
    (comp.lang.java.programmer)
  • Re: Initializers
    ... 'constructor' to Ada packages maybe? ... the things they do Ada reference manual calls "package ... You can attach your code to elaboration in many ways. ... Initialize called etc. ...
    (comp.lang.ada)