bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CDK keybinding


From: Thomas Dickey
Subject: Re: CDK keybinding
Date: Wed, 18 Mar 2009 19:41:16 -0400 (EDT)

On Tue, 17 Mar 2009, TheLonelyStar wrote:


Hi,

I am currently learning CDK from the examples (as suggested in this forums).
I have a "main window" wich is mainly a selection widget.
Now I want that when the "n" key is pressed, a dialog for a new item for the
selection pops up.
So I have to to rebind the "n" key for the selection window. I see to
options:

1. Bind the "n" key in a way, that the activateCDKSelection exits and tells
me in its return value, that the n key was the reaseon.
Problem: How do I bind a key that exits the activate function and how do I
set the return value?

bindings in CDK make it do a callback (to a given function).
The callback functions get the object pointer, and the key.

CDK maintains an exit type - but it's not the key value.
It's vERROR, vNORMAL, etc., which correspond by default to ERR, newline, etc. The default is vEARLY_EXIT, which keeps the widget looping.


2. Bind the "n" key to open the dialog and insert the new item.
Problem: How can I insert an item into a selection without recreating it
(and while activateCDKSelection is runnig).

see setCDKSelectionItems and setCDKSelectionChoice


What would you do?

(I'd read the library code as a supplement to reading the manpages)

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]