473,395 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get a keypress?

The ncurses functions are such a mess (and some of it I suspect is in
ncurses itself) that I am thinking the easiest way to write a terminal
interface is simply to write ANSI directly to the terminal.

Although the manual on the CLI refers me to readline, readline doesn't
seem provide a way to get a single key press, and so far as I can tell
doesn't provide a reference to how to get a single keypress. I reckon
some widgets would be more spiffy with keypresses instead of whole lines.

How can I get keypresses?

--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 493 days to go.
What do you do when you're debranded?
Sep 14 '07 #1
3 6910
Lars Eighner wrote:
The ncurses functions are such a mess (and some of it I suspect is in
ncurses itself) that I am thinking the easiest way to write a terminal
interface is simply to write ANSI directly to the terminal.

Although the manual on the CLI refers me to readline, readline doesn't
seem provide a way to get a single key press, and so far as I can tell
doesn't provide a reference to how to get a single keypress. I reckon
some widgets would be more spiffy with keypresses instead of whole lines.

How can I get keypresses?
If you're on Windows, you can't. You have to press the enter key to
'send' the input. Unix/Linux it's supposed to work as expected. Haven't
tried it yet though.

Norm
Sep 14 '07 #2
Lars Eighner asked...
How can I get keypresses?
"Norman Peelman" replied...
: If you're on Windows, you can't.

HTML provides a way to get a keypress. Usually this can be
done with javascript or HTML inside the <headsection or
HTML inside the body. I've not messed with it, but have seen
it in other folks code.

If he just wants a way to provide client-side control, it's
called accesskey in HTML-speak.

http://www.w3.org/TR/html4/interact/...html#h-17.11.2

That combined with some javascript to do an automatic POST,
probably can get the OP where he wants to go.

--
Jim Carlock
Swimming Pool, Spa And Water Feature Builders
http://www.aquaticcreationsnc.com/
Sep 14 '07 #3
Jim Carlock wrote:
Lars Eighner asked...
>How can I get keypresses?

"Norman Peelman" replied...
: If you're on Windows, you can't.

HTML provides a way to get a keypress. Usually this can be
done with javascript or HTML inside the <headsection or
HTML inside the body. I've not messed with it, but have seen
it in other folks code.

If he just wants a way to provide client-side control, it's
called accesskey in HTML-speak.

http://www.w3.org/TR/html4/interact/...html#h-17.11.2

That combined with some javascript to do an automatic POST,
probably can get the OP where he wants to go.
The OP is in a terminal (cli) window... no browser.

Norm
Sep 15 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Alex007 | last post by:
Hi, I've been working on this C assignement for a CS course.... the assignement is going pretty well and all my code works well on both Windows and Linux. The only thing that doesn't work is...
3
by: Darryn Ross | last post by:
Hi, I am trying to catch the KeyPress event on my datagrid but it isn't working... i have also tried registering the handler with the event like this... dgGLBatch.KeyPress += new...
2
by: rege | last post by:
Hi, I have two applications developed in C# say A and B. When user presses key "L" with applicaition A active , it causes a keypress event which causes application B to run. Application A then...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
3
by: Fia | last post by:
Hi In Visual Basic 6 I could call keypress with an integer of a choosen key. For example I could call a textbox's keypress with the number 13 (for the enter key). But now in Visual Basic .Net I...
5
by: Henry Jones | last post by:
I am new to C# and wanted to capture the KeyPress for a textbox. I created some code as follows: private void textBox3_KeyPress(object sender, System.EventArgs e) { this.textBox2.Text =...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.