* Error converting from UTF8 to ISO-8859-1 @ 2009-07-29 15:11 ldries46 2009-07-29 15:55 ` Dmitry A. Kazakov 0 siblings, 1 reply; 8+ messages in thread From: ldries46 @ 2009-07-29 15:11 UTC (permalink / raw) 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. L. Dries ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Error converting from UTF8 to ISO-8859-1 2009-07-29 15:11 Error converting from UTF8 to ISO-8859-1 ldries46 @ 2009-07-29 15:55 ` Dmitry A. Kazakov 2009-07-29 16:46 ` ldries46 0 siblings, 1 reply; 8+ messages in thread From: Dmitry A. Kazakov @ 2009-07-29 15:55 UTC (permalink / raw) 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Error converting from UTF8 to ISO-8859-1 2009-07-29 15:55 ` Dmitry A. Kazakov @ 2009-07-29 16:46 ` ldries46 2009-07-29 17:20 ` Dmitry A. Kazakov 0 siblings, 1 reply; 8+ messages in thread From: ldries46 @ 2009-07-29 16:46 UTC (permalink / raw) 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@dmitry-kazakov.de> schreef in bericht news:8isqph858n0s$.krle17w7i2z1$.dlg@40tude.net... > 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Error converting from UTF8 to ISO-8859-1 2009-07-29 16:46 ` ldries46 @ 2009-07-29 17:20 ` Dmitry A. Kazakov [not found] ` <4a717cbf$0$31793$703f8584@news.kpn.nl> 0 siblings, 1 reply; 8+ messages in thread From: Dmitry A. Kazakov @ 2009-07-29 17:20 UTC (permalink / raw) On Wed, 29 Jul 2009 18:46:08 +0200, ldries46 wrote: > Herewith I sent the complete code of the .adb file that I have made. You should post a complete code that can be compiled, linked and executed. When you design a new Gtk widget, you should have a package interface and body and a test program that creates the widget. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <4a717cbf$0$31793$703f8584@news.kpn.nl>]
* Re: Error converting from UTF8 to ISO-8859-1 [not found] ` <4a717cbf$0$31793$703f8584@news.kpn.nl> @ 2009-07-30 15:01 ` Dmitry A. Kazakov 2009-07-30 15:08 ` Dmitry A. Kazakov 1 sibling, 0 replies; 8+ messages in thread From: Dmitry A. Kazakov @ 2009-07-30 15:01 UTC (permalink / raw) On Thu, 30 Jul 2009 12:58:15 +0200, ldries46 wrote: > My only interest at this moment is to find the reason for the Error messages > and the way to avoid them. The way to activate the buttons is something I > try to discover myself because I want to understand what I do Your code contains errors. Wall_Color_Pkg: ---------------------------------------------------- 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 -- This is 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); -- This connects to plain Gtk.Handlers.Callback ^^ 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; ---------------------------------------------------- I have no idea what you are trying to achieve, but using Gtk.Handlers.User_Callback could go as follows: ---------------------------------------------------- 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 Escape_Intl; use Escape_Intl; package body Wall_Color_Pkg is package Button_Callback is new Gtk.Handlers.User_Callback ( Gtk_Button_Record, Wall_Color_Access ); procedure On_WallFloorOK_Activate ( Button : access GTK_Button_Record'Class; Widget : Wall_Color_Access ) 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 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", Button_CallBack.To_Marshaller (On_WallFloorOK_Activate'Access), Wall_Color.all'Unchecked_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; ---------------------------------------------------- -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Error converting from UTF8 to ISO-8859-1 [not found] ` <4a717cbf$0$31793$703f8584@news.kpn.nl> 2009-07-30 15:01 ` Dmitry A. Kazakov @ 2009-07-30 15:08 ` Dmitry A. Kazakov 2009-08-06 8:50 ` ldries46 1 sibling, 1 reply; 8+ messages in thread From: Dmitry A. Kazakov @ 2009-07-30 15:08 UTC (permalink / raw) P.S. When using GtkAda under GPS, always include gtkada.gpr into your project file. In no case you should never ever use the Linker_Options pragma. A project file could look like this: with "gtkada.gpr"; -- Note this project Escape is type Development_Type is ("Debug", "Release"); Development : Development_Type := external ("Development", "Debug"); type Legacy_Type is ("Ada95", "Ada2005"); Legacy : Legacy_Type := external ("Legacy", "Ada2005"); for Main use ("escape.adb"); package Binder is case Development is when "Debug" => for Default_Switches ("ada") use ("-E"); when "Release" => for Default_Switches ("ada") use (); end case; end Binder; package Builder is case Development is when "Debug" => for Default_Switches ("ada") use ("-g"); when "Release" => for Default_Switches ("ada") use ("-s"); end case; end Builder; package Compiler is case Development is when "Debug" => case Legacy is when "Ada2005" => for Default_Switches ("ada") use ("-gnato", "-gnatf", "-g", "-fstack-check", "-gnat05"); when "Ada95" => for Default_Switches ("ada") use ("-gnato", "-gnatf", "-g", "-fstack-check", "-gnat95"); end case; when "Release" => case Legacy is when "Ada2005" => for Default_Switches ("ada") use ("-gnato", "-gnatf", "-O2", "-gnatn", "-gnat05"); when "Ada95" => for Default_Switches ("ada") use ("-gnato", "-gnatf", "-O2", "-gnatn", "-gnat95"); end case; end case; end Compiler; package Linker is -- Linker switches are here case Development is when "Debug" => for Default_Switches ("ada") use Gtkada.Linker'Default_Switches ("ada") & "-g" & "-mwindows"; when "Release" => for Default_Switches ("ada") use Gtkada.Linker'Default_Switches ("ada") & "-O2" & "-mwindows"; end case; end Linker; end Escape; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Error converting from UTF8 to ISO-8859-1 2009-07-30 15:08 ` Dmitry A. Kazakov @ 2009-08-06 8:50 ` ldries46 2009-08-06 10:03 ` Dmitry A. Kazakov 0 siblings, 1 reply; 8+ messages in thread From: ldries46 @ 2009-08-06 8:50 UTC (permalink / raw) Thanks for the help. I'm working on my program again. The question I send first still is not answered because every time I have an error I still get the three converting error in the same file but I the file is correct is correctly compiled and in the use of it works correctly. "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> schreef in bericht news:i58mu1sn7qag.n2khre66reir$.dlg@40tude.net... > P.S. > > When using GtkAda under GPS, always include gtkada.gpr into your project > file. In no case you should never ever use the Linker_Options pragma. A > project file could look like this: > > with "gtkada.gpr"; -- Note this > > project Escape is > > type Development_Type is ("Debug", "Release"); > Development : Development_Type := external ("Development", "Debug"); > > type Legacy_Type is ("Ada95", "Ada2005"); > Legacy : Legacy_Type := external ("Legacy", "Ada2005"); > > for Main use ("escape.adb"); > > package Binder is > case Development is > when "Debug" => > for Default_Switches ("ada") use ("-E"); > when "Release" => > for Default_Switches ("ada") use (); > end case; > end Binder; > > package Builder is > case Development is > when "Debug" => > for Default_Switches ("ada") use ("-g"); > when "Release" => > for Default_Switches ("ada") use ("-s"); > end case; > end Builder; > > package Compiler is > case Development is > when "Debug" => > case Legacy is > when "Ada2005" => > for Default_Switches ("ada") use > ("-gnato", "-gnatf", "-g", "-fstack-check", > "-gnat05"); > when "Ada95" => > for Default_Switches ("ada") use > ("-gnato", "-gnatf", "-g", "-fstack-check", > "-gnat95"); > end case; > when "Release" => > case Legacy is > when "Ada2005" => > for Default_Switches ("ada") use > ("-gnato", "-gnatf", "-O2", "-gnatn", "-gnat05"); > when "Ada95" => > for Default_Switches ("ada") use > ("-gnato", "-gnatf", "-O2", "-gnatn", "-gnat95"); > end case; > end case; > end Compiler; > > package Linker is -- Linker switches are here > case Development is > when "Debug" => > for Default_Switches ("ada") use Gtkada.Linker'Default_Switches > ("ada") & "-g" & "-mwindows"; > when "Release" => > for Default_Switches ("ada") use Gtkada.Linker'Default_Switches > ("ada") & "-O2" & "-mwindows"; > end case; > end Linker; > > end Escape; > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Error converting from UTF8 to ISO-8859-1 2009-08-06 8:50 ` ldries46 @ 2009-08-06 10:03 ` Dmitry A. Kazakov 0 siblings, 0 replies; 8+ messages in thread From: Dmitry A. Kazakov @ 2009-08-06 10:03 UTC (permalink / raw) On Thu, 6 Aug 2009 10:50:11 +0200, ldries46 wrote: > Thanks for the help. I'm working on my program again. > The question I send first still is not answered because every time I have an > error I still get the three converting error in the same file but I the file > is correct is correctly compiled and in the use of it works correctly. As always, you should a compilable, linkable code that illustrates the problem. Before doing so you should first reduce it to essentials. In the process of reducing you will probably find the problem yourself. If the problem persists when reduced to 2-3 files of 50 lines long, you are ready to report it. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-08-06 10:03 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-07-29 15:11 Error converting from UTF8 to ISO-8859-1 ldries46 2009-07-29 15:55 ` Dmitry A. Kazakov 2009-07-29 16:46 ` ldries46 2009-07-29 17:20 ` Dmitry A. Kazakov [not found] ` <4a717cbf$0$31793$703f8584@news.kpn.nl> 2009-07-30 15:01 ` Dmitry A. Kazakov 2009-07-30 15:08 ` Dmitry A. Kazakov 2009-08-06 8:50 ` ldries46 2009-08-06 10:03 ` Dmitry A. Kazakov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox