comp.lang.ada
 help / color / mirror / Atom feed
* GtkAda or Ada or a binding?  Keys
@ 2001-09-23 15:36 chris.danx
  2001-09-24  7:26 ` Jacob Sparre Andersen
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: chris.danx @ 2001-09-23 15:36 UTC (permalink / raw)


Hi,

Does GtkAda have any support for getting key presses from the user?  The
problem I've got is to use GtkAda to make Tetris like game (in order to
improve my understanding of GtkAda.  What?  It's less boring than making a
spreadsheet or something).  I need a way to check if there are any key
presses pending, if there are then I need to get them and do the appropriate
action.

In TPascal it would probably make use of readkey and keypressed.  If GtkAda
doesn't support such a thing (which is likely) what about Ada?  Is there a
way to check for an input in the buffer, and get it if there is?  Will I
have to bind to C or something?  Or is there another solution?

I thought about using get(character) but that'd mean the user would have to
input a character on every step and it wouldn't go anywhere until it got
one.

Thanks,
Chris





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
@ 2001-09-24  7:26 ` Jacob Sparre Andersen
  2001-09-24 13:43   ` Ted Dennison
  2001-09-24  9:23 ` Emmanuel Briot
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Jacob Sparre Andersen @ 2001-09-24  7:26 UTC (permalink / raw)


Chris:

> Does GtkAda have any support for getting key presses from the user?

You might want to look at Ada.Text_IO.Get_Immediate.

Jacob
-- 
"Human beings just can't not communicate."



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
  2001-09-24  7:26 ` Jacob Sparre Andersen
@ 2001-09-24  9:23 ` Emmanuel Briot
  2001-09-24 20:14 ` David Botton
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Emmanuel Briot @ 2001-09-24  9:23 UTC (permalink / raw)


"chris.danx" <chris.danx@ntlworld.com> writes:

> Does GtkAda have any support for getting key presses from the user?  The
> problem I've got is to use GtkAda to make Tetris like game (in order to
> improve my understanding of GtkAda.  What?  It's less boring than making a
> spreadsheet or something).  I need a way to check if there are any key
> presses pending, if there are then I need to get them and do the appropriate
> action.

Of course it does, like most GUI toolkits. How would a text editor work
otherwise, for instance ?
Consider the signal defined in Gtk.Widget, call  key_press_event.

You might also want to read a X-Window or Win32 manual (depending on your
system), if you are not confident enough with programming GUI toolkits.

Emmanuel



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-24  7:26 ` Jacob Sparre Andersen
@ 2001-09-24 13:43   ` Ted Dennison
  0 siblings, 0 replies; 20+ messages in thread
From: Ted Dennison @ 2001-09-24 13:43 UTC (permalink / raw)


In article <3BAEE03A.3DDB8E2F@nbi.dk>, Jacob Sparre Andersen says...
>
>Chris:
>
>> Does GtkAda have any support for getting key presses from the user?
>
>You might want to look at Ada.Text_IO.Get_Immediate.

Unfortunately, on many OS's the user still would have to have pressed the Enter
key before keypresses are available to Get_Immediate. If your OS is one of
those, then you would have to make some sort of system call to get keypresses.

Most window managers come with a way to do this. Gtk is no exception. What you'd
want to do is set your application up to receive keypress events (GdkEvents of
type GdkEventKey). You could also probably do it with menu accelerator keys, but
that seems a bit cheesy. You can set button press and button release events for
any "Widget". If I'm remembering my Gtk+ properly, you'd probably want to set it
for your outermost-container, but its probably something that you'd have to play
with a bit.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
  2001-09-24  7:26 ` Jacob Sparre Andersen
  2001-09-24  9:23 ` Emmanuel Briot
@ 2001-09-24 20:14 ` David Botton
  2001-09-24 20:27   ` Preben Randhol
                     ` (3 more replies)
  2001-09-25  4:48 ` Bobby D. Bryant
                   ` (3 subsequent siblings)
  6 siblings, 4 replies; 20+ messages in thread
From: David Botton @ 2001-09-24 20:14 UTC (permalink / raw)
  To: comp.lang.ada

You may also want to start with GWindows (if you are on Windows) which is a
lot easier and has a number of very nice tutorials to get you started in GUI
programming. (http://www.adapower.com/gwindows)

Later if you need the cross platform support you can go back to GtkAda.

David Botton

BTW You may want to try in the future asking the GtkAda e-mail list first
when looking for specifics.


----- Original Message -----
From: "chris.danx" <chris.danx@ntlworld.com>


> Hi,
>
> Does GtkAda have any support for getting key presses from the user?  The
> problem I've got is to use GtkAda to make Tetris like game (in order to
> improve my understanding of GtkAda.  What?  It's less boring than making a
> spreadsheet or something).  I need a way to check if there are any key
> presses pending, if there are then I need to get them and do the
appropriate
> action.
>
> In TPascal it would probably make use of readkey and keypressed.  If
GtkAda
> doesn't support such a thing (which is likely) what about Ada?  Is there a
> way to check for an input in the buffer, and get it if there is?  Will I
> have to bind to C or something?  Or is there another solution?
>
> I thought about using get(character) but that'd mean the user would have
to
> input a character on every step and it wouldn't go anywhere until it got
> one.
>
> Thanks,
> Chris





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-24 20:14 ` David Botton
@ 2001-09-24 20:27   ` Preben Randhol
  2001-09-25 18:41     ` David Botton
       [not found]     ` <00af01c145f1$a9cd8d60$0100a8c0@DBINSPIRON>
  2001-09-24 20:51   ` chris.danx
                     ` (2 subsequent siblings)
  3 siblings, 2 replies; 20+ messages in thread
From: Preben Randhol @ 2001-09-24 20:27 UTC (permalink / raw)


On Mon, 24 Sep 2001 16:14:28 -0400, David Botton wrote:
> You may also want to start with GWindows (if you are on Windows) which is a
> lot easier and has a number of very nice tutorials to get you started in GUI
> programming. (http://www.adapower.com/gwindows)

I haven't looked at Gwindows (as I use Linux mainly), but how is the
design of the GUI compared to GtkAda? Do one pack widgets or is it more
like Delphi with fixed locations?

Preben Randhol



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-24 20:14 ` David Botton
  2001-09-24 20:27   ` Preben Randhol
@ 2001-09-24 20:51   ` chris.danx
  2001-09-28 22:43     ` Stefan Skoglund
  2001-09-25 18:09   ` tmoran
  2001-09-25 19:48   ` chris.danx
  3 siblings, 1 reply; 20+ messages in thread
From: chris.danx @ 2001-09-24 20:51 UTC (permalink / raw)


"David Botton" <David@Botton.com> wrote in message
news:mailman.1001363062.27045.comp.lang.ada@ada.eu.org...
> You may also want to start with GWindows (if you are on Windows) which is
a
> lot easier and has a number of very nice tutorials to get you started in
GUI
> programming. (http://www.adapower.com/gwindows)

Which is something that GtkAda lacks, good tutorials.  If I was only
targetting Windows I'd use GWindows, primarily for the reason that it does
have tutorials, even if GtkAda offered me the option to port later.

Even before the tutorials Gwindows was easy to learn, but to have them makes
a real difference (clears up any misconceptions, etc).


> Later if you need the cross platform support you can go back to GtkAda.

The reason for using GtkAda is to develop cross platform apps.  I wanted to
create a different kind of application from the toy programs that i've been
playing with so far.  Thanks for the suggestion and keep up the excellent
work on Gwindows.

Hmm, maybe it is better to start with GWindows since, in the past GUI
programming was something I let JBuilder, etc worry about.

> David Botton
>
> BTW You may want to try in the future asking the GtkAda e-mail list first
> when looking for specifics.

Oky doky.  I thought it'd be best to ask here in this instance but unless
it's a specific Ada issue I'll ask on GtkAda.



Thanks David,
Chris





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
                   ` (2 preceding siblings ...)
  2001-09-24 20:14 ` David Botton
@ 2001-09-25  4:48 ` Bobby D. Bryant
  2001-09-28 22:32 ` Stefan Skoglund
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 20+ messages in thread
From: Bobby D. Bryant @ 2001-09-25  4:48 UTC (permalink / raw)


In article <0onr7.9325$Ck.1581110@news6-win.server.ntlworld.com>,
"chris.danx" <chris.danx@ntlworld.com> wrote:

> Does GtkAda have any support for getting key presses from the user? 

Yes, you will need to set up a callback for a "key_press_event", and
provide a procedure (with a particular kind of signature) to actually
handle the event.

There will be some uphill learning before you can figure out how to do
that, but in my experience it has been well worthwhile.

Bobby Bryant
Austin, Texas



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-24 20:14 ` David Botton
  2001-09-24 20:27   ` Preben Randhol
  2001-09-24 20:51   ` chris.danx
@ 2001-09-25 18:09   ` tmoran
  2001-09-25 19:48   ` chris.danx
  3 siblings, 0 replies; 20+ messages in thread
From: tmoran @ 2001-09-25 18:09 UTC (permalink / raw)


You may also want to start with Claw if you are on Windows.
You can see a partial (pre-release) example of its tutorials at
http://members.home.net/twmoran/H1.htm
(note the H1 must be capitalized !@#$%)



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-24 20:27   ` Preben Randhol
@ 2001-09-25 18:41     ` David Botton
       [not found]     ` <00af01c145f1$a9cd8d60$0100a8c0@DBINSPIRON>
  1 sibling, 0 replies; 20+ messages in thread
From: David Botton @ 2001-09-25 18:41 UTC (permalink / raw)
  To: comp.lang.ada

Either. You can fix positions, dock and pack. Take a look at the tutorial on
the web off the GWindows page.

http://www.adapower.com/gwindows

The major differences are that GWindows is all native controls (with some
custom to GWindows and more in the works) and the event models.

David Botton

----- Original Message -----
From: "Preben Randhol" <randhol+abuse@pvv.org>

> I haven't looked at Gwindows (as I use Linux mainly), but how is the
> design of the GUI compared to GtkAda? Do one pack widgets or is it more
> like Delphi with fixed locations?





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-24 20:14 ` David Botton
                     ` (2 preceding siblings ...)
  2001-09-25 18:09   ` tmoran
@ 2001-09-25 19:48   ` chris.danx
  2001-09-25 20:09     ` David Botton
  3 siblings, 1 reply; 20+ messages in thread
From: chris.danx @ 2001-09-25 19:48 UTC (permalink / raw)



"David Botton" <David@Botton.com> wrote in message
news:mailman.1001363062.27045.comp.lang.ada@ada.eu.org...
> You may also want to start with GWindows (if you are on Windows) which is
a
> lot easier and has a number of very nice tutorials to get you started in
GUI
> programming. (http://www.adapower.com/gwindows)

I had a previous version 0.3 of Gwindows installed and removed it.  I
dowloaded the beta release of GWindows and followed the instructions,
however when I type make ANSI=1 install it gives the error "too many
parameters - &" over and over.  I have checked my path which is

SET PATH=D:\GNAT\BIN;D:\GNATCOM-1.3P\BIN;%PATH%
SET ADA_INCLUDE_PATH=d:\gwindows;d:\xmlada\src
SET ADA_OBJECTS_PATH=d:\gwindows;d:\xmlada\lib

and can see nothing that would cause this.  This is reminiscent of something
Jeff Creem mentioned in relation to GtkAda (which I removed from the path
before installing Gwindows), about differences between sh and command.com
(or something like that) along the lines of one of them not taking "&",
thereby disallowing multiple commands to be issued on one line.

I typed make -v and was given

GNU Make version 3.77

How do I compile Gwindows on W98 with 3.13p and avoid this error?

Any and all help is appreciated,
Chris





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-25 19:48   ` chris.danx
@ 2001-09-25 20:09     ` David Botton
  2001-09-25 20:59       ` chris.danx
  2001-09-26 17:23       ` Sergey Koshcheyev
  0 siblings, 2 replies; 20+ messages in thread
From: David Botton @ 2001-09-25 20:09 UTC (permalink / raw)
  To: comp.lang.ada

As it says in the readme on Win9X you need to use the Batch file instead of
the make or upgrade to Win2K :-)

David Botton

BTW, There is an e-mail list dedicated to GNATCOM and GWindows, better to
use that for specifics like this. See http://www.adapower.com/gwindows for
more information.

----- Original Message -----
From: "chris.danx" <chris.danx@ntlworld.com>
>
> How do I compile Gwindows on W98 with 3.13p and avoid this error?
>





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
       [not found]     ` <00af01c145f1$a9cd8d60$0100a8c0@DBINSPIRON>
@ 2001-09-25 20:10       ` David Botton
  0 siblings, 0 replies; 20+ messages in thread
From: David Botton @ 2001-09-25 20:10 UTC (permalink / raw)
  To: comp.lang.ada

I almost forgot. Also, you can use any Dialog Editor such as MSDev,
Borlands, or a free one from the lcc project (see the GWindows home page) to
create a dialog template. You can then use GWindows to create windows from
the template with that layout.

With cbind from Dmitriy Anisimkov (http://members.tripod.com/vagul/) you can
even automatically generate the Ada code for the resource header file
(containing all resource identifier constants).

For example in my GNavi project (the Delhpi/VB replacement :-) I just
slipped cbind in the make file and use MSDev for all my resource editing.

David Botton



----- Original Message -----
From: "David Botton" <David@Botton.com>
To: <comp.lang.ada@ada.eu.org>
Sent: Tuesday, September 25, 2001 2:41 PM
Subject: Re: GtkAda or Ada or a binding? Keys


> Either. You can fix positions, dock and pack. Take a look at the tutorial
on
> the web off the GWindows page.
>
> http://www.adapower.com/gwindows
>
> The major differences are that GWindows is all native controls (with some
> custom to GWindows and more in the works) and the event models.
>
> David Botton
>
> ----- Original Message -----
> From: "Preben Randhol" <randhol+abuse@pvv.org>
>
> > I haven't looked at Gwindows (as I use Linux mainly), but how is the
> > design of the GUI compared to GtkAda? Do one pack widgets or is it more
> > like Delphi with fixed locations?
>
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>




^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-25 20:09     ` David Botton
@ 2001-09-25 20:59       ` chris.danx
  2001-09-26 17:23       ` Sergey Koshcheyev
  1 sibling, 0 replies; 20+ messages in thread
From: chris.danx @ 2001-09-25 20:59 UTC (permalink / raw)



"David Botton" <David@Botton.com> wrote in message
news:mailman.1001448627.22795.comp.lang.ada@ada.eu.org...
> As it says in the readme on Win9X you need to use the Batch file instead
of

Thanks David,

I unpacked the wrong distro, gwindows.zip instead of gwindows-beta1e.zip!
Stupid idiot!


Thanks again,
Chris


> the make or upgrade to Win2K :-)

If only.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-25 20:09     ` David Botton
  2001-09-25 20:59       ` chris.danx
@ 2001-09-26 17:23       ` Sergey Koshcheyev
  1 sibling, 0 replies; 20+ messages in thread
From: Sergey Koshcheyev @ 2001-09-26 17:23 UTC (permalink / raw)


"David Botton" <David@Botton.com> wrote in message
news:mailman.1001448627.22795.comp.lang.ada@ada.eu.org...
>
> BTW, There is an e-mail list dedicated to GNATCOM and GWindows, better to
> use that for specifics like this. See http://www.adapower.com/gwindows for
> more information.
>

Is there an archive for this mailing list available somewhere?

Sergey Koshcheyev.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
                   ` (3 preceding siblings ...)
  2001-09-25  4:48 ` Bobby D. Bryant
@ 2001-09-28 22:32 ` Stefan Skoglund
  2001-09-28 22:41 ` Stefan Skoglund
  2001-09-28 22:45 ` Stefan Skoglund
  6 siblings, 0 replies; 20+ messages in thread
From: Stefan Skoglund @ 2001-09-28 22:32 UTC (permalink / raw)


"chris.danx" wrote:
> Does GtkAda have any support for getting key presses from the user?  The
> problem I've got is to use GtkAda to make Tetris like game (in order to

Most books about Gtk+ has some treaties on game programming.
Including Harlow's prgramming linux with gtk+ or something like that.

> improve my understanding of GtkAda.  What?  It's less boring than making a
> spreadsheet or something).  I need a way to check if there are any key

You need to pick up the key down and key up events.
You must also deal with enter notify.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
                   ` (4 preceding siblings ...)
  2001-09-28 22:32 ` Stefan Skoglund
@ 2001-09-28 22:41 ` Stefan Skoglund
  2001-09-28 22:45 ` Stefan Skoglund
  6 siblings, 0 replies; 20+ messages in thread
From: Stefan Skoglund @ 2001-09-28 22:41 UTC (permalink / raw)


"chris.danx" wrote:
> spreadsheet or something).  I need a way to check if there are any key
> presses pending, if there are then I need to get them and do the appropriate
> action.

1. You should pick up some gtk+ book for example dev. linux apps with
gtk+ and gdk.

   What i'm saying is straight from the book.

2. you must create event handlers for key_press_event and
key_release_event.
   remember that gtk+ by default doesnt emits key_release_event's . read
up
   on gtk_widget_set_events

  hmm, i missunderstand you a little , that i said is mostly for games
ie run
 along a path while blasting any poor enemies.


3. creating handlers for key_press_release will be enough.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-24 20:51   ` chris.danx
@ 2001-09-28 22:43     ` Stefan Skoglund
  2001-09-29 11:39       ` Aidan Skinner
  0 siblings, 1 reply; 20+ messages in thread
From: Stefan Skoglund @ 2001-09-28 22:43 UTC (permalink / raw)


"chris.danx" wrote:
> Which is something that GtkAda lacks, good tutorials.  If I was only
> targetting Windows I'd use GWindows, primarily for the reason that it does

I'm still recommending one of the Gtk+ books.
Look for Havoc's book about gnome programming.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
                   ` (5 preceding siblings ...)
  2001-09-28 22:41 ` Stefan Skoglund
@ 2001-09-28 22:45 ` Stefan Skoglund
  6 siblings, 0 replies; 20+ messages in thread
From: Stefan Skoglund @ 2001-09-28 22:45 UTC (permalink / raw)


The tutorial about gtk at http://www.gtk.org/tutorial/ should help.



^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: GtkAda or Ada or a binding?  Keys
  2001-09-28 22:43     ` Stefan Skoglund
@ 2001-09-29 11:39       ` Aidan Skinner
  0 siblings, 0 replies; 20+ messages in thread
From: Aidan Skinner @ 2001-09-29 11:39 UTC (permalink / raw)


On Sat, 29 Sep 2001 00:43:22 +0200, Stefan Skoglund <stetson@ebox.tninet.se>
wrote in <3BB4FD0A.56DE660F@ebox.tninet.se>:

>  I'm still recommending one of the Gtk+ books.
>  Look for Havoc's book about gnome programming.

It's online at http://developer.gnome.org/doc/GGAD/ggad.html

It's also in the gnome CVS repository and there's a tar file of the html at
http://developer.gnome.org/doc/GGAD/GGAD.tar.gz

- Aidan (surfacing from 18 months of web development purgatory)
-- 
http://www.velvet.net/~aidan/           aidan@velvet.net
No Fear




^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2001-09-29 11:39 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-23 15:36 GtkAda or Ada or a binding? Keys chris.danx
2001-09-24  7:26 ` Jacob Sparre Andersen
2001-09-24 13:43   ` Ted Dennison
2001-09-24  9:23 ` Emmanuel Briot
2001-09-24 20:14 ` David Botton
2001-09-24 20:27   ` Preben Randhol
2001-09-25 18:41     ` David Botton
     [not found]     ` <00af01c145f1$a9cd8d60$0100a8c0@DBINSPIRON>
2001-09-25 20:10       ` David Botton
2001-09-24 20:51   ` chris.danx
2001-09-28 22:43     ` Stefan Skoglund
2001-09-29 11:39       ` Aidan Skinner
2001-09-25 18:09   ` tmoran
2001-09-25 19:48   ` chris.danx
2001-09-25 20:09     ` David Botton
2001-09-25 20:59       ` chris.danx
2001-09-26 17:23       ` Sergey Koshcheyev
2001-09-25  4:48 ` Bobby D. Bryant
2001-09-28 22:32 ` Stefan Skoglund
2001-09-28 22:41 ` Stefan Skoglund
2001-09-28 22:45 ` Stefan Skoglund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox