Browse thread
keyboard mapping with lablgtk2
- Christian Schlager
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christian Schlager <Christian.Schlager@t...> |
| Subject: | keyboard mapping with lablgtk2 |
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