And BTW is anybody working on a Linux port?
--
Michael Bode
Yes.
> My last requests for assistance from the members of the GWindows
> mailing list produced no responses
I don't recall seeing a message from you. The last message I have from
that mailing list was 30 August. Perhaps I missed it. With such a small
group, it can take time for messages to be noted and addressed.
Stephen
I've never seen any reference to a Linux port of GWindows myself.
Stephen
I have one application that I'm trying to port to GWindows, but it's
not high on my list of things to do.
--
-- Stephe
I certainly hope not.
The original rational for GWindows was to be a rational Ada binding to
the Microsoft Windows API.
Changing that to some other OS/GUI combination would be just wrong.
Which windowing API do you want on Gnu/Linux?
--
-- Stephe
David Botton had been looking into if Gwindows would work well when
linked to winelib under Linux.
The August message titled "Can't get an on_focus/on_lost_focus to work
for buttons" was from me (I use a pseudonym in cla in order to avoid
spammers)
> The original rational for GWindows was to be a rational Ada binding to
> the Microsoft Windows API.
>
> Changing that to some other OS/GUI combination would be just wrong.
But not making the GUI lib portable makes it useless for projects
targeting more than just Windows. One of the advantages of Java is
its portable GUI toolkit(s).
GNAVI is using GWindows and it says:
(http://www.gnavi.org/index.php?Command=Index&Title=Home)
GNAVI is the open source alternative to visual software development
languages like Delphi and Visual Basic. In addition to just being
fully Open Source under the GPL, the language foundation of GNAVI,
unlike Pascal or Basic of its competition, is the international
standard of engineering, Ada. GNAVI for Windows offers comparable
features to Delphi and Visual Basic including use of Active X
controls and the ability to interface with .NET and Java. GNAVI is
also currently being ported to Mac OS X and Linux/UNIX
But it seems there is not much development going on for the ports.
> Which windowing API do you want on Gnu/Linux?
Probably GTK+, because that's what I know from GtkAda :-). More
important it is widely used and plain C, which may make it easier to
bind to than something written in C++. But if there is a better choice
I wouldn't object.
--
Michael Bode
> The August message titled "Can't get an on_focus/on_lost_focus to work
> for buttons" was from me (I use a pseudonym in cla in order to avoid
> spammers)
Ok, got it. I don't have an immediate answer. But as it happens I have
a job to do with GWindows at the moment, so I'll see if I strike the
same problem. No promises on a solution.
Stephen
> The August message titled "Can't get an on_focus/on_lost_focus to work
> for buttons" was from me (I use a pseudonym in cla in order to avoid
> spammers)
Ok, got it. I don't have an immediate answer. But as it happens I have
Maybe off-topic from the initial question, but just for your information,
an effort is currently made to create a binding to Qt. Yes, it's C++,
so it's much more difficult to achieve. No, it's not yet ready to be used,
and as long as I'm the only developer it won't be finished any time soon.
But I've already manage to re-create in pure Ada the 7 first tutorials,
the 8th should be done, well, next week I hope.
Side note, it compiles and runs on both Linux and Windows (using MinGW).
Other platforms are yet to be tested though.
If you're interested : http://qt4ada.sourceforge.net
Regards,
--
(o< | Yves Bailly : http://kafka-fr.net | -o)
//\ | Linux Dijon : http://www.coagul.org | //\
\_/ | | \_/`
>> Which windowing API do you want on Gnu/Linux?
>
> Probably GTK+, because that's what I know from GtkAda :-). More
> important it is widely used and plain C, which may make it easier to
> bind to than something written in C++. But if there is a better choice
> I wouldn't object.
Though GTK+ performs quite poorly on Windows platform. And overall, when
its documentation tells you that you fundamentally cannot save and restore
the position of a window, what could you say?
In my opinion it must be 100% Ada. I don't believe in C.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
> Stephen Leake <stephe...@stephe-leake.org> writes:
>
>> The original rational for GWindows was to be a rational Ada binding to
>> the Microsoft Windows API.
>>
>> Changing that to some other OS/GUI combination would be just wrong.
>
> But not making the GUI lib portable makes it useless for projects
> targeting more than just Windows.
Obviously.
So if you require portability across platforms, don't use GWindows.
On the other hand, making the GUI lib portable means using only those
features common to all of the targeted platforms.
So if you want your application to be able to take full advantage of
the Win32 API, use GWindows.
>> Which windowing API do you want on Gnu/Linux?
>
> Probably GTK+, because that's what I know from GtkAda :-).
So use GtkAda on Windows as well.
--
-- Stephe
> Michael Bode wrote:
>>> Which windowing API do you want on Gnu/Linux?
>>
>> Probably GTK+, because that's what I know from GtkAda :-). More
>> important it is widely used and plain C, which may make it easier to
>> bind to than something written in C++. But if there is a better choice
>> I wouldn't object.
>
> Maybe off-topic from the initial question, but just for your information,
> an effort is currently made to create a binding to Qt. Yes, it's C++,
> so it's much more difficult to achieve. No, it's not yet ready to be used,
> and as long as I'm the only developer it won't be finished any time soon.
> But I've already manage to re-create in pure Ada the 7 first tutorials,
> the 8th should be done, well, next week I hope.
> Side note, it compiles and runs on both Linux and Windows (using MinGW).
> Other platforms are yet to be tested though.
> If you're interested : http://qt4ada.sourceforge.net
Are you aware of this qtada binding:
http://freehost07.websamba.com/guibuilder/
I downloaded it but the zero docs prevented me of trying it. It is in my
todo list for spare time. I find GtkAda extremely unpleasant to work with,
and I remember from early times that Qt programming in c++ was very
straightforward. In any case I like much better the looks of Qt apps over
Gtk+ ones. Or at least kde over gnome ones (yikes... not trying to start a
fw here!).
In any case keep us informed of your progress.
But you are right, besides Stephen I don't see much activity on GWindows
repository. The last sign of life from David over 6 months ago.
Now on your actual question (yes sometimes a trigger works):
To get the BN_SETFOCUS or BN_KILLFOCUS, the button needs to have the
BS_NOTIFY style. I added a On_Pre_Create handler to set this style.
I added the changed code:
with GWindows,
GWindows.Base,
GWindows.Windows,
GWindows.Windows.Main,
GWindows.Buttons,
GWindows.Edit_Boxes;
use GWindows,
GWindows.Base,
GWindows.Windows,
GWindows.Windows.Main,
GWindows.Buttons,
GWindows.Edit_Boxes;
with Interfaces.C;
with GWindows.Application;
procedure TestKB is
pragma Linker_Options ("-mwindows");
Main_Window : Main_Window_Type;
Exit_Button : Button_Type;
TestButton : Button_Type;
Edit_Box : Edit_Box_Type;
-- Event handlers ---------
-- Exit_Button_Click
procedure Exit_Button_Click (
Window : in out GWindows.Base.Base_Window_Type'Class
)
is
pragma Warnings (Off, Window);
begin
GWindows.Application.End_Application;
end Exit_Button_Click;
-- TestButton_Focus
procedure TestButton_Focus (
Window : in out GWindows.Base.Base_Window_Type'Class
)
is
pragma Warnings (Off, Window);
begin
Text (Edit_Box, "Focus");
end TestButton_Focus;
-- TestButton_Lost_Focus
procedure TestButton_Lost_Focus (
Window : in out GWindows.Base.Base_Window_Type'Class
)
is
pragma Warnings (Off, Window);
begin
Text (Edit_Box, "Lost focus");
end TestButton_Lost_Focus;
procedure TestButton_Pre_Create
(Window : in out GWindows.Base.Base_Window_Type'Class;
dwStyle : in out Interfaces.C.unsigned;
dwExStyle : in out Interfaces.C.unsigned)
is
pragma Warnings (Off, Window);
pragma Warnings (Off, dwExStyle);
use type Interfaces.C.unsigned;
BS_NOTIFY : constant := 16#4000#;
begin
dwStyle := dwStyle or BS_NOTIFY;
end TestButton_Pre_Create;
begin
Create (
Main_Window,
"Test Button",
Width => 400,
Height => 300
);
Keyboard_Support (Main_Window, True);
Create (
Exit_Button,
Main_Window,
Text => "E&xit",
Left => 300,
Top => 225,
Width => 75,
Height => 34
);
On_Click_Handler (Exit_Button, Exit_Button_Click'Unrestricted_Access);
On_Pre_Create_Handler (TestButton,
TestButton_Pre_Create'Unrestricted_Access);
Create (
TestButton,
Main_Window,
Text => "&Test",
Left => 30,
Top => 30,
Width => 125,
Height => 25
);
On_Focus_Handler (TestButton, TestButton_Focus'Unrestricted_Access);
On_Lost_Focus_Handler (TestButton,
TestButton_Lost_Focus'Unrestricted_Access);
Create (
Edit_Box,
Main_Window,
Text => "",
Left => 30,
Top => 70,
Width => 125,
Height => 25
);
Visible (Main_Window, True);
Focus (TestButton);
GWindows.Application.Message_Loop;
end TestKB;
André
Yes I am, but this binding is for Qt3, I wanted one for Qt4.
Also it's Ada95, not Ada2005, and I wanted to pratice Ada2005.
Last note, for various reasons I don't really like the way it
is structured, I wanted to have a type hierarchy in Ada reflecting
exactly the type hierarchy in C++.
> In any case keep us informed of your progress.
Of course :-)
> Though GTK+ performs quite poorly on Windows platform.
How? For me it works quite well.
> And overall, when its documentation tells you that you fundamentally
> cannot save and restore the position of a window, what could you
> say?
Get toplevel window position from a widget:
declare
Gwin : Gdk.Window.Gdk_Window;
X, Y : Glib.Gint;
begin
Gwin := Gtk.Widget.Get_Window (Get_Toplevel (Widget));
Gdk.Window.Get_Position (Gwin, X, Y);
end;
Set toplevel position:
Gtk.Widget.Set_UPosition (Widget, X, Y);
--
Michael Bode
> Though GTK+ performs quite poorly on Windows platform. And overall, when
GPS manages to work pretty well on Windows and it is using GtkAda. It
uses to perform poorly, but things have improved a lot since a year or so.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
>
>Yes, we are still using it in a few applications.
>
>But you are right, besides Stephen I don't see much activity on GWindows
>repository. The last sign of life from David over 6 months ago.
>
>Now on your actual question (yes sometimes a trigger works):
>
>To get the BN_SETFOCUS or BN_KILLFOCUS, the button needs to have the
>BS_NOTIFY style. I added a On_Pre_Create handler to set this style.
>
>I added the changed code:
>
>with GWindows,
>
... code sample snipped ...
Works perfectly. Many thanks.
I expect that this technique will also solve a problem that I am
having with radio button; the GWindows version of a radio button is
also lacking a BS_NOTIFY style.
> "Dmitry A. Kazakov" <mai...@dmitry-kazakov.de> writes:
>
>> Though GTK+ performs quite poorly on Windows platform.
>
> How? For me it works quite well.
Did you try tree view under Windows, for example? I did, a lot. There are
numerous problems with it. For instance, refresh does not work well upon
resizing of panes containing tree views.
Do you have X-sever (cygnus) and a Linux host? Compile your Ada application
on Linux and start it side-by-side once remotely under X-sever once
natively. The difference between X11 and Windows GTK will become obvious.
>> And overall, when its documentation tells you that you fundamentally
>> cannot save and restore the position of a window, what could you
>> say?
>
> Get toplevel window position from a widget:
>
> declare
> Gwin : Gdk.Window.Gdk_Window;
> X, Y : Glib.Gint;
> begin
> Gwin := Gtk.Widget.Get_Window (Get_Toplevel (Widget));
> Gdk.Window.Get_Position (Gwin, X, Y);
> end;
>
> Set toplevel position:
> Gtk.Widget.Set_UPosition (Widget, X, Y);
I only quoted GTK+ documentation. GtkAda's one repeats it:
https://libre2.adacore.com/GtkAda/docs/2.8/gtkada_rm/gtk-window.html
> Dmitry A. Kazakov a écrit :
>
>> Though GTK+ performs quite poorly on Windows platform. And overall, when
>
> GPS manages to work pretty well on Windows and it is using GtkAda. It
> uses to perform poorly, but things have improved a lot since a year or so.
True. I hope they will continue so. The next step could be to stop talking
about "GTK+ for Win32," as a *separate* project on their home page!
> Did you try tree view under Windows, for example? I did, a lot. There are
> numerous problems with it. For instance, refresh does not work well upon
> resizing of panes containing tree views.
> I only quoted GTK+ documentation. GtkAda's one repeats it:
>
> https://libre2.adacore.com/GtkAda/docs/2.8/gtkada_rm/gtk-window.html
Do yo refer to this paragraph?
If you are saving and restoring your application's window positions,
you should know that it's impossible for applications to do this
without getting it somewhat wrong because applications do not have
sufficient knowledge of window manager state. The Correct Mechanism
is to support the session management protocol (see the "GnomeClient"
object in the GNOME libraries for example) and allow the window
manager to save your window sizes and positions.
This says it is not a GTK+ problem but a X11 / window manager
problem. If this is true no X11 toolkit can do something about it.
What I've seen is this:
Set_UPosition seems to set the position of the whole window including
border an title bar. Get_Position seems to return the position of the
client area of the window. If your desktop has a panel on the top of
the root window, you get another offset. You can compare the results
of the GTK functions with the output of xwininfo.
--
Michael Bode