[gtk-server] Re: Accelerator keys - Warning, newbie questions

  • From: Peter van Eerten <administrator@xxxxxxxxxxxxxx>
  • To: gtk-server@xxxxxxxxxxxxx
  • Date: Sat, 02 Sep 2006 13:37:29 +0200

Hi Derek,

> It seems that the GTK Server can only assign one accelerator key per widget
> because only Ctrl+a (select all, the first one I assigned) works. Is this
> true?

No, this is not true. Attached to this mail a Glade project file, containing a
TextView with the four defined accelerator keys. This is my BASIC program:

-----------------------------------
#!/usr/bin/scriba

IMPORT gtk.bas

GLOBAL CONST nl = "\n"

gtk_server_cfg("log")
PRINT gtk_server_version(), nl

gtk_server_glade_file("project1.glade")

REM To get the internal ID of a widget, if needed
REM WIN = gtk_server_glade_widget("window")

REPEAT
    event = gtk_server_callback("wait")
UNTIL TRUE

END
-----------------------------------

If I start it, all accelerator keys work fine. I can cut, copy and paste. There
is an errormessage though, for <CTRL>+<A> ('select_all' signal) stating that the
signal needs an extra argument. But there is no way with Glade to put it there.
Therefore you probably should assign the signal manually in your program.

Programmatically you must use the GtkAcceleratorGroups, they are discussed here:

http://www.gtk.org/api/2.6/gtk/gtk-Keyboard-Accelerators.html


For details on usage of accelerator keys, please refer to the extensive GTK
documentation or -mailingslists.

Regards
Peter

Citeren Derek Griffin <d_griffin@xxxxxxxxxxxxxxxx>:

> Hi Peter,
>
> I have designed a GUI with Glade which includes a text view box. In Glade I
> added accelerator keys for cut, copy, paste and select all (Ctrl+x etc).
>
> It seems that the GTK Server can only assign one accelerator key per widget
> because only Ctrl+a (select all, the first one I assigned) works. Is this
> true?
>
> How can I get the GTK Server to allow multiple accelerator keys for one text
> view box?
>
> How are accelerator keys assigned by scripting? I've looked through the
> config file and the GTK reference manual and found nothing that appears to
> even hint at this.
>
> Thanks,
>
> Derek.


-- 
http://www.gtk-server.org

Other related posts: