caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* keyboard mapping with lablgtk2
@ 2005-02-15 20:11 Christian Schlager
  0 siblings, 0 replies; only message in thread
From: Christian Schlager @ 2005-02-15 20:11 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 924 bytes --]

hi there,


i want to create a special keyboard mode for creating tables in a textview widget with lablgtk2.
To create one row the user should move with ENTER from cell to cell until the end is reached 
and then ENTER to the next row:

this is my callback-function:

let key_pressed (textview:GText.view) (ev:GdkEvent.Key.t) =
  let newch = GdkEvent.Key.string ev in
  let buffer = textview#buffer in
  let iter = buffer#end_iter in
  if (newch = "\n") then
    buffer#insert ~iter "   "
  else
    buffer#insert ~iter newch;
  true

For now it should insert empty spaces when ENTER is hit. Unfortunately it
doesn't work, it just inserts a new line.
Also, the functionality of the keyboard is limited, the backspace key for 
instance doesn't work, but i could work around that thing.
Who can tell me how to correctly test the keys?
A code snippet might be helpful, too.

Thanks for help,
Christian

[-- Attachment #2: Type: text/html, Size: 2219 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-15 20:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15 20:11 keyboard mapping with lablgtk2 Christian Schlager

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).