* Gtkada, Gtkada_Builder.Add_From_String problem.
@ 2016-08-08 13:24 George J
2016-08-08 14:34 ` Dmitry A. Kazakov
2016-08-09 3:10 ` George J
0 siblings, 2 replies; 12+ messages in thread
From: George J @ 2016-08-08 13:24 UTC (permalink / raw)
Hi all! Today i've got a problem with Add_From_String method of Gtkada_Builder. I have an xml (GLADE) file, which loading fine with Add_From_File. So i've copied text in String var, and Add_From_String doesn't work. May be I don't know some feature of this method?
there are to examples i've made
1.
use ASCII;
UI_Str : String :=
"<?xml version=""1.0"" encoding=""UTF-8""?>" &
"<interface>" &
"<!-- interface-requires gtk+ 3.0 -->" &
"<object class=""GtkListStore"" id=""List_Store_Drives"">" &
"<columns>" &
"<!-- column-name nm -->" &
"<column type=""gchararray""/>" &
"<!-- column-name sz -->" &............
2.
use ASCII;
UI_Str : String :=
"<?xml version=""1.0"" encoding=""UTF-8""?>" & LF & CR &
"<interface>" & LF & CR &
"<!-- interface-requires gtk+ 3.0 -->" & LF & CR &
"<object class=""GtkListStore"" id=""List_Store_Drives"">" & LF & CR &
"<columns>" & LF & CR &
"<!-- column-name nm -->" & LF & CR &
"<column type=""gchararray""/>" & LF & CR &
"<!-- column-name sz -->" & LF & CR &...........
Result:
..............
if 0=Builder.Add_From_String(Buffer => UI.UI_Str,
Error => Error'Access) then
return;-- <--Comes here!!!!
end if;
Hope smb can help. Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 13:24 Gtkada, Gtkada_Builder.Add_From_String problem George J
@ 2016-08-08 14:34 ` Dmitry A. Kazakov
2016-08-08 14:54 ` George J
2016-08-09 3:10 ` George J
1 sibling, 1 reply; 12+ messages in thread
From: Dmitry A. Kazakov @ 2016-08-08 14:34 UTC (permalink / raw)
On 2016-08-08 15:24, George J wrote:
> Hi all! Today i've got a problem with Add_From_String method of
> Gtkada_Builder. I have an xml (GLADE) file, which loading fine with
> Add_From_File. So i've copied text in String var, and Add_From_String
> doesn't work. May be I don't know some feature of this method?
>
> there are to examples i've made
> 1.
> use ASCII;
> UI_Str : String :=
> "<?xml version=""1.0"" encoding=""UTF-8""?>" &
> "<interface>" &
> "<!-- interface-requires gtk+ 3.0 -->" &
> "<object class=""GtkListStore"" id=""List_Store_Drives"">" &
> "<columns>" &
> "<!-- column-name nm -->" &
> "<column type=""gchararray""/>" &
> "<!-- column-name sz -->" &............
>
> 2.
> use ASCII;
>
> UI_Str : String :=
> "<?xml version=""1.0"" encoding=""UTF-8""?>" & LF & CR &
> "<interface>" & LF & CR &
> "<!-- interface-requires gtk+ 3.0 -->" & LF & CR &
> "<object class=""GtkListStore"" id=""List_Store_Drives"">" & LF & CR &
> "<columns>" & LF & CR &
> "<!-- column-name nm -->" & LF & CR &
> "<column type=""gchararray""/>" & LF & CR &
> "<!-- column-name sz -->" & LF & CR &...........
>
> Result:
> ..............
> if 0=Builder.Add_From_String(Buffer => UI.UI_Str,
> Error => Error'Access) then
> return;-- <--Comes here!!!!
> end if;
Error should contain some info, though I presume that the interpreter
does not understand LF-CR line terminator. Try LF instead, or none.
Better though, never ever use either GLADE or XML.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 14:34 ` Dmitry A. Kazakov
@ 2016-08-08 14:54 ` George J
2016-08-08 16:01 ` Dmitry A. Kazakov
0 siblings, 1 reply; 12+ messages in thread
From: George J @ 2016-08-08 14:54 UTC (permalink / raw)
понедельник, 8 августа 2016 г., 17:34:31 UTC+3 пользователь Dmitry A. Kazakov написал:
> On 2016-08-08 15:24, George J wrote:
> > Hi all! Today i've got a problem with Add_From_String method of
> > Gtkada_Builder. I have an xml (GLADE) file, which loading fine with
> > Add_From_File. So i've copied text in String var, and Add_From_String
> > doesn't work. May be I don't know some feature of this method?
> >
> > there are to examples i've made
> > 1.
> > use ASCII;
> > UI_Str : String :=
> > "<?xml version=""1.0"" encoding=""UTF-8""?>" &
> > "<interface>" &
> > "<!-- interface-requires gtk+ 3.0 -->" &
> > "<object class=""GtkListStore"" id=""List_Store_Drives"">" &
> > "<columns>" &
> > "<!-- column-name nm -->" &
> > "<column type=""gchararray""/>" &
> > "<!-- column-name sz -->" &............
> >
> > 2.
> > use ASCII;
> >
> > UI_Str : String :=
> > "<?xml version=""1.0"" encoding=""UTF-8""?>" & LF & CR &
> > "<interface>" & LF & CR &
> > "<!-- interface-requires gtk+ 3.0 -->" & LF & CR &
> > "<object class=""GtkListStore"" id=""List_Store_Drives"">" & LF & CR &
> > "<columns>" & LF & CR &
> > "<!-- column-name nm -->" & LF & CR &
> > "<column type=""gchararray""/>" & LF & CR &
> > "<!-- column-name sz -->" & LF & CR &...........
> >
> > Result:
> > ..............
> > if 0=Builder.Add_From_String(Buffer => UI.UI_Str,
> > Error => Error'Access) then
> > return;-- <--Comes here!!!!
> > end if;
>
> Error should contain some info, though I presume that the interpreter
> does not understand LF-CR line terminator. Try LF instead, or none.
>
> Better though, never ever use either GLADE or XML.
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
Yes,Dmitry!Thanks for reply!Error returned 0x440. I'm coming home now, so didn't look for what it means yet. And for " never use GLADE or XML " : i don't know how to make beautiful and understandeable GUI with Ada in other way. Could you suggest something?
Ok. I'll try with LF.
Thanks!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 14:54 ` George J
@ 2016-08-08 16:01 ` Dmitry A. Kazakov
2016-08-08 16:42 ` George J
0 siblings, 1 reply; 12+ messages in thread
From: Dmitry A. Kazakov @ 2016-08-08 16:01 UTC (permalink / raw)
On 2016-08-08 16:54, George J wrote:
> And for " never use GLADE or XML " : i don't know how to make
> beautiful and understandeable GUI with Ada in other way. Could you
> suggest something?
It is not Ada specific.
GTK is designed with widgets having no fixed layout in mind. There is a
complex mechanism how children widgets communicate with the parameters
in order to obtain their sizes. A GUI builder does not work well in this
environment. It does not work well even when widgets are fixed, e.g.
Win32 GDI with MS resource editor. Then GTK is permanently under
incompatible changes. GLADE is poorly maintained and never catches up
with the changes. All this makes GLADE programs practically unmaintainable.
Just create widgets and put them into containers (boxes, grids, tables)
from the program. Always create your specific widgets by deriving from
existing ones (usually containers) and doing initialization in
Initialize, which you call from Gtk_New. Use GTK signals and properties.
You can define new signals and properties for your widgets when necessary.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 16:01 ` Dmitry A. Kazakov
@ 2016-08-08 16:42 ` George J
2016-08-08 19:08 ` Dmitry A. Kazakov
0 siblings, 1 reply; 12+ messages in thread
From: George J @ 2016-08-08 16:42 UTC (permalink / raw)
понедельник, 8 августа 2016 г., 19:01:46 UTC+3 пользователь Dmitry A. Kazakov написал:
> On 2016-08-08 16:54, George J wrote:
>
> > And for " never use GLADE or XML " : i don't know how to make
> > beautiful and understandeable GUI with Ada in other way. Could you
> > suggest something?
>
> It is not Ada specific.
>
> GTK is designed with widgets having no fixed layout in mind. There is a
> complex mechanism how children widgets communicate with the parameters
> in order to obtain their sizes. A GUI builder does not work well in this
> environment. It does not work well even when widgets are fixed, e.g.
> Win32 GDI with MS resource editor. Then GTK is permanently under
> incompatible changes. GLADE is poorly maintained and never catches up
> with the changes. All this makes GLADE programs practically unmaintainable.
>
> Just create widgets and put them into containers (boxes, grids, tables)
> from the program. Always create your specific widgets by deriving from
> existing ones (usually containers) and doing initialization in
> Initialize, which you call from Gtk_New. Use GTK signals and properties.
> You can define new signals and properties for your widgets when necessary.
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
Ok Dmitry. I'll convert my project with this method and watch,what happens with it. But whether it not a waste of time to do GUI application manually?
p.s. And, BTW, i couldn't install GPS installer today, GTKADA contributions and other components on GNAT 2016 with compiled and built gps_installer.exe, so i've put folder "gtkada_contributions" with my project and use that files this way: "with Gtk.Main.Router;" etc. What can I do to install it properly? or GNAT 2016 doesn't supported?
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 16:42 ` George J
@ 2016-08-08 19:08 ` Dmitry A. Kazakov
2016-08-08 22:41 ` olivermkellogg
2016-08-09 3:00 ` George J
0 siblings, 2 replies; 12+ messages in thread
From: Dmitry A. Kazakov @ 2016-08-08 19:08 UTC (permalink / raw)
On 2016-08-08 18:42, George J wrote:
> понедельник, 8 августа 2016 г., 19:01:46 UTC+3 пользователь Dmitry A. Kazakov написал:
>> On 2016-08-08 16:54, George J wrote:
>>
>But whether it not a waste of time to do GUI application manually?
If the GUI is more or less complex you would not be able to create it
otherwise.
> p.s. And, BTW, i couldn't install GPS installer today, GTKADA
> contributions and other components on GNAT 2016 with compiled and built
> gps_installer.exe,
Possibly, I didn't put any efforts into it since AdaCore announced
gprinstall. You should try it instead, but actually there is no need for
installation of sources under Windows.
> so i've put folder "gtkada_contributions" with my
> project and use that files this way: "with Gtk.Main.Router;" etc.
> What can I do to install it properly?
You just put files into some directory and then add the directory path
to the ADA_PROJECT_PATH. That is all.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 19:08 ` Dmitry A. Kazakov
@ 2016-08-08 22:41 ` olivermkellogg
2016-08-09 3:08 ` George J
2016-08-09 8:06 ` Dmitry A. Kazakov
2016-08-09 3:00 ` George J
1 sibling, 2 replies; 12+ messages in thread
From: olivermkellogg @ 2016-08-08 22:41 UTC (permalink / raw)
On Monday, August 8, 2016 at 9:08:29 PM UTC+2, Dmitry A. Kazakov wrote:
> [...]
> If the GUI is more or less complex you would not be able to create it
> otherwise.
At my work, we developed Link-16 [1] support tools with literally hundreds of layout pages.
I wonder how long it would have taken to make all these layouts without a GUI builder.
(To be precise, they were originally made using RAPID [2] and converted to Glade using rapid2glade.pl [3])
-- Oliver
[1] https://en.wikipedia.org/wiki/Link_16
[2] http://savannah.nongnu.org/p/rapid
[3] http://okellogg.de/rapid2glade.pl
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 19:08 ` Dmitry A. Kazakov
2016-08-08 22:41 ` olivermkellogg
@ 2016-08-09 3:00 ` George J
1 sibling, 0 replies; 12+ messages in thread
From: George J @ 2016-08-09 3:00 UTC (permalink / raw)
понедельник, 8 августа 2016 г., 22:08:29 UTC+3 пользователь Dmitry A. Kazakov написал:
> On 2016-08-08 18:42, George J wrote:
> > понедельник, 8 августа 2016 г., 19:01:46 UTC+3 пользователь Dmitry A. Kazakov написал:
> >> On 2016-08-08 16:54, George J wrote:
> >>
> >But whether it not a waste of time to do GUI application manually?
>
> If the GUI is more or less complex you would not be able to create it
> otherwise.
>
> > p.s. And, BTW, i couldn't install GPS installer today, GTKADA
> > contributions and other components on GNAT 2016 with compiled and built
> > gps_installer.exe,
>
> Possibly, I didn't put any efforts into it since AdaCore announced
> gprinstall. You should try it instead, but actually there is no need for
> installation of sources under Windows.
>
> > so i've put folder "gtkada_contributions" with my
> > project and use that files this way: "with Gtk.Main.Router;" etc.
> > What can I do to install it properly?
>
> You just put files into some directory and then add the directory path
> to the ADA_PROJECT_PATH. That is all.
>
> --
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de
Thanks Dmitry! I'll try it!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 22:41 ` olivermkellogg
@ 2016-08-09 3:08 ` George J
2016-08-09 8:06 ` Dmitry A. Kazakov
1 sibling, 0 replies; 12+ messages in thread
From: George J @ 2016-08-09 3:08 UTC (permalink / raw)
вторник, 9 августа 2016 г., 1:41:47 UTC+3 пользователь oliverm...@gmail.com написал:
> On Monday, August 8, 2016 at 9:08:29 PM UTC+2, Dmitry A. Kazakov wrote:
> > [...]
> > If the GUI is more or less complex you would not be able to create it
> > otherwise.
>
> At my work, we developed Link-16 [1] support tools with literally hundreds of layout pages.
> I wonder how long it would have taken to make all these layouts without a GUI builder.
> (To be precise, they were originally made using RAPID [2] and converted to Glade using rapid2glade.pl [3])
>
> -- Oliver
>
> [1] https://en.wikipedia.org/wiki/Link_16
> [2] http://savannah.nongnu.org/p/rapid
> [3] http://okellogg.de/rapid2glade.pl
Thanks, Oliver!I haven't ever use this instrument. Are there any examples or small tutors on Rapid?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 13:24 Gtkada, Gtkada_Builder.Add_From_String problem George J
2016-08-08 14:34 ` Dmitry A. Kazakov
@ 2016-08-09 3:10 ` George J
2016-08-09 3:40 ` George J
1 sibling, 1 reply; 12+ messages in thread
From: George J @ 2016-08-09 3:10 UTC (permalink / raw)
понедельник, 8 августа 2016 г., 16:24:58 UTC+3 пользователь George J написал:
> Hi all! Today i've got a problem with Add_From_String method of Gtkada_Builder. I have an xml (GLADE) file, which loading fine with Add_From_File. So i've copied text in String var, and Add_From_String doesn't work. May be I don't know some feature of this method?
>
> there are to examples i've made
> 1.
> use ASCII;
> UI_Str : String :=
> "<?xml version=""1.0"" encoding=""UTF-8""?>" &
> "<interface>" &
> "<!-- interface-requires gtk+ 3.0 -->" &
> "<object class=""GtkListStore"" id=""List_Store_Drives"">" &
> "<columns>" &
> "<!-- column-name nm -->" &
> "<column type=""gchararray""/>" &
> "<!-- column-name sz -->" &............
>
> 2.
> use ASCII;
>
> UI_Str : String :=
> "<?xml version=""1.0"" encoding=""UTF-8""?>" & LF & CR &
> "<interface>" & LF & CR &
> "<!-- interface-requires gtk+ 3.0 -->" & LF & CR &
> "<object class=""GtkListStore"" id=""List_Store_Drives"">" & LF & CR &
> "<columns>" & LF & CR &
> "<!-- column-name nm -->" & LF & CR &
> "<column type=""gchararray""/>" & LF & CR &
> "<!-- column-name sz -->" & LF & CR &...........
>
> Result:
> ..............
> if 0=Builder.Add_From_String(Buffer => UI.UI_Str,
> Error => Error'Access) then
> return;-- <--Comes here!!!!
> end if;
>
> Hope smb can help. Thanks!
SOLUTION HAS BEEN FOUND. String to Add_From_String must be at UTF-8 encoding format.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-09 3:10 ` George J
@ 2016-08-09 3:40 ` George J
0 siblings, 0 replies; 12+ messages in thread
From: George J @ 2016-08-09 3:40 UTC (permalink / raw)
вторник, 9 августа 2016 г., 6:10:06 UTC+3 пользователь George J написал:
> понедельник, 8 августа 2016 г., 16:24:58 UTC+3 пользователь George J написал:
> > Hi all! Today i've got a problem with Add_From_String method of Gtkada_Builder. I have an xml (GLADE) file, which loading fine with Add_From_File. So i've copied text in String var, and Add_From_String doesn't work. May be I don't know some feature of this method?
> >
> > there are to examples i've made
> > 1.
> > use ASCII;
> > UI_Str : String :=
> > "<?xml version=""1.0"" encoding=""UTF-8""?>" &
> > "<interface>" &
> > "<!-- interface-requires gtk+ 3.0 -->" &
> > "<object class=""GtkListStore"" id=""List_Store_Drives"">" &
> > "<columns>" &
> > "<!-- column-name nm -->" &
> > "<column type=""gchararray""/>" &
> > "<!-- column-name sz -->" &............
> >
> > 2.
> > use ASCII;
> >
> > UI_Str : String :=
> > "<?xml version=""1.0"" encoding=""UTF-8""?>" & LF & CR &
> > "<interface>" & LF & CR &
> > "<!-- interface-requires gtk+ 3.0 -->" & LF & CR &
> > "<object class=""GtkListStore"" id=""List_Store_Drives"">" & LF & CR &
> > "<columns>" & LF & CR &
> > "<!-- column-name nm -->" & LF & CR &
> > "<column type=""gchararray""/>" & LF & CR &
> > "<!-- column-name sz -->" & LF & CR &...........
> >
> > Result:
> > ..............
> > if 0=Builder.Add_From_String(Buffer => UI.UI_Str,
> > Error => Error'Access) then
> > return;-- <--Comes here!!!!
> > end if;
> >
> > Hope smb can help. Thanks!
>
> SOLUTION HAS BEEN FOUND. String to Add_From_String must be at UTF-8 encoding format.
Thanks to all!!
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Gtkada, Gtkada_Builder.Add_From_String problem.
2016-08-08 22:41 ` olivermkellogg
2016-08-09 3:08 ` George J
@ 2016-08-09 8:06 ` Dmitry A. Kazakov
1 sibling, 0 replies; 12+ messages in thread
From: Dmitry A. Kazakov @ 2016-08-09 8:06 UTC (permalink / raw)
On 09/08/2016 00:41, olivermkellogg@gmail.com wrote:
> On Monday, August 8, 2016 at 9:08:29 PM UTC+2, Dmitry A. Kazakov wrote:
>> [...]
>> If the GUI is more or less complex you would not be able to create it
>> otherwise.
>
> At my work, we developed Link-16 [1] support tools with literally hundreds of layout pages.
It is kind of alarming to hear that GTK is used for such applications.
No safety requirements at all?
> I wonder how long it would have taken to make all these layouts without a GUI builder.
Is it dialog forms? I would probably generate them dynamically from the
list of fields. The advantage is that you can integrate the plausibility
checks into the widget data type representing the form.
Such GUIs are very rare, at least in automation and control. In any case
fixed dialog forms is the least problem with GUI implementation, even if
you have hundreds of. Lists, tree views and text edit widgets make real
trouble and GUI builder is only hindrance there. Furthermore, forms are
usually dynamic, you have some fields present or not depending on the
context and other inputs.
> (To be precise, they were originally made using RAPID [2] and
> converted to Glade using rapid2glade.pl [3])
Why not to directly deserialize widgets skipping GLADE? In a comparable
case:
http://www.dmitry-kazakov.de/ada/aicwl.htm#13
the editor only changes widget properties. All widgets support
serialization/deserialization interface (stream I/O). Though manual
widget construction is still easier than drawing.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2016-08-09 8:06 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 13:24 Gtkada, Gtkada_Builder.Add_From_String problem George J
2016-08-08 14:34 ` Dmitry A. Kazakov
2016-08-08 14:54 ` George J
2016-08-08 16:01 ` Dmitry A. Kazakov
2016-08-08 16:42 ` George J
2016-08-08 19:08 ` Dmitry A. Kazakov
2016-08-08 22:41 ` olivermkellogg
2016-08-09 3:08 ` George J
2016-08-09 8:06 ` Dmitry A. Kazakov
2016-08-09 3:00 ` George J
2016-08-09 3:10 ` George J
2016-08-09 3:40 ` George J
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox