An accel is a keyboard shortcut. You should take a look at
gtk_window_add_accel_group() and the GtkAccelGroup API.

For speech synthesis, I would use the libespeak API instead - the same
library espeak uses. This way you can omit the file handling part of your
code. This page should contain everything you need, but there are several
examples out there: http://espeak.sourceforge.net/speak_lib.h

Best,
Gergely
On 4 Sep 2014 06:02, "Gary Kline" <kl...@thought.org> wrote:

> =====
> Organization: Thought Unlimited.  Public service Unix since 1986.
> Of_Interest: With 28 years  of service  to the  Unix  community.
>
> On Thu, Sep 04, 2014 at 12:32:06AM +0200, Gergely Polonkai wrote:
> > Hello Gary,
> >
> > do I get it right, you want to manupulate/query the labels upon
> > keypresses? Like when the user presses the Up arrow, fetch the text of
> > the first label and print it somewhere?
>
>         *YES*.  in another directory, three or four C files grab hold
>         of [[ Say ]] /tmp/files/text.3.txt {or} /tmp/files/text.NN.txt.
>         these TXT files contain what the speech-ompaired person has
>         typed.  they are voiced by espeak and other speech binaries.
>
>         when I hit the up- or doen-arrow button I want SOmething to
>         appear on the "window" that has the arrow icons.  when the
>         user hits Enter or mouse-clicks, that Something voices what
>         the users himself cannot.
>
>
> > In that case, I’d like to know
> > if you have a GtkApplication with GtkApplicationWindows, or “just” a
> > simple GtkWindow?
>
>
>         in my arrow.c, in main(), I have a
>
>         GtkWidget *window;
>
>         and after gtk_init() is:
>
>
>         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>         .
>         .
>         .
>         so it is just a simple window.
>
>
>
>
> > For the former, I would go for actions and accels (see
> > gtk_application_set_accels_for_action() and friends), while the former
> > may require catching the ::key-press-event signal.
> >
> > Best,
> > Gergely
>
>
>         I'll google around and see what functions do what!  iv'e seen
>         the `accels' scroll past while searching for other parts of
>         code.  I had 0.0 idea what it was. :)
>
>         thanks much,
>
>         gary
>
>
>
> > On 4 September 2014 00:24, Gary Kline <kl...@thought.org> wrote:
> > > =====
> > > Organization: Thought Unlimited.  Public service Unix since 1986.
> > > Of_Interest: With 28 years  of service  to the  Unix  community.
> > >
> > > On Wed, Sep 03, 2014 at 10:44:55PM +0200, Marcus Karlsson wrote:
> > >> On Wed, Sep 03, 2014 at 01:13:06PM -0700, Gary Kline wrote:
> > >> >     thanks for your input, marcus, but could you give me a few
> lines of
> > >> >     code?  I tried using the gtk_label_set_text() for over an hour
> > >> >     last night until it felt like my shoulder was going to drop off
> and
> > >> >     fall on the floor!
> > >>
> > >> You should be able to set the text with something like:
> > >>
> > >> gtk_label_set_text (GTK_LABEL (label), "some text");
> > >>
> > >> But this requires that you have a valid pointer to your label, eiter
> in
> > >> a global variable or passed to the signal handler as the user_data
> > >> pointer.
> > >>
> > >> >     other than usinng "g_signal_connect()" to bail out with a Quit,
> > >> >     the only times I see anything to do with a signal are after
> going
> > >> >     GTK_ARROW_UP or _DOWN....  I may have misplaced the
> > >> >     gtk_label_get_text() stuff.
> > >> >
> > >> >     iv'e got:
> > >> >
> > >> >     gtk_label_get_text(GTK_LABEL(user_data), buf );
> > >> >
> > >> >     which now looks aways off...  need more clues.
> > >>
> > >> Gtk_label_get_text () returns the string in the return value, so you
> > >> need to to something like:
> > >>
> > >> str = gtk_label_get_text (GTK_LABEL (user_data));
> > >>
> > >> This of course also requires that the user_data pointer is pointing
> at a
> > >> label. In your code sample you passed 0 and 1 as the pointers, which
> > >> most likely will not be valid pointers to your labels.
> > >>
> > >> It's often a good idea to group the elements that you need to access
> > >> into an object and pass it as the user_data pointer. A struct would be
> > >> sufficient. This could also include a field which says which label is
> > >> currently selected, for example using and int in the range of 1 to 3.
> > >>
> > >> If you want to reuse the signal handler and still distinguish which
> > >> button caused the signal then you can use the currently unused first
> > >> argument which should point to the sender of the signal, or the button
> > >> which was pressed down.
> > >>
> > >>               Marcus
> > >
> > >         well, here's the dope: after my 27th cup of french roast, it's
> all
> > >         coming together. *Or*, with a few more hacks, most things will
> fit.
> > >
> > >         still, no one has been able to answer my main question: how,
> using
> > >         the arrow keys, do I attach onto the individual labels?  I
> print
> > >         3 labels to demonstrate what will appear of the window.  there
> > >         probably will be dozens of strings that will become labels.  I
> > >         need the up/down arrow keys to select One label.  Another part
> of
> > >         the program will speak that string.
> > >
> > >         your code examples  were helpful.  my main snafu was in mixing
> up
> > >         the "GTK_MACROS".  The main step is getting the arrow keys to
> > >         incicatte--probably with a horizontal line--the right label.
> > >
> > >         gary
> > >
> > >
> > > --
> > >  Gary Kline  kl...@thought.org  http://www.thought.org  Public
> Service Unix
> > >              Twenty-eight years of service to the Unix community.
> > >
> > >
> > > _______________________________________________
> > > gtk-app-devel-list mailing list
> > > gtk-app-devel-list@gnome.org
> > > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
> --
>  Gary Kline  kl...@thought.org  http://www.thought.org  Public Service
> Unix
>              Twenty-eight years of service to the Unix community.
>
>
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to