LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-02-2013, 10:42 AM   #1
LQ123
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Rep: Reputation: Disabled
newt text based UI


Newt forms can exit via both F12 and Esc.

Please, how can the calling program tell which exit route was taken?
 
Old 03-03-2013, 05:19 AM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
I'm not familiar with the program, but it's possible to check the exit code, maybe it indicates there how the program was exited.

In bash, $? holds the exit code of the last command executed.
 
Old 03-04-2013, 12:55 AM   #3
LQ123
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
newt is a set of C-functions, not a stand-alone program.
You include the header (newt.h) in your program and then use the functions.

I have not been able to find much documentation, apart from an old tutorial.
It was apparently used for UI in the text-mode Fedora installer
 
Old 03-04-2013, 06:02 AM   #4
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Fedora, OpenSUSE, FreeBSD, OpenBSD, macOS (hack). Past: Debian, Arch, RedHat (pre-RHEL).
Posts: 1,335
Blog Entries: 7

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
Yes, I just checked it out, documentation is quite poor.

I see the functions return ints. Have you compared the values when pressing ESC and F12?

You may have to check the key yourself and return from your function using your own return codes.
 
Old 03-04-2013, 06:21 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,843

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
in general the two keypress event connected to the same event handler (exit function). In that case you will have no information about the keypress. But also you can have different handlers for different keys therefore they can behave differently.
As far as I see there are two functions: void newtWaitForKey(void); and void newtClearKeyBuffer(void); to handle keypresses, you need to check the source code how it is really implemented.
 
Old 03-04-2013, 07:09 AM   #6
LQ123
LQ Newbie
 
Registered: Mar 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
I was trying the
>>>
newtComponent newtRunForm(newtComponent form)
<<<
function, which seems to be legacy.

The modern version is
>>>
newtFormRun()
<<<
which is supposed to fill a structure, maybe including data on the exiting form component (just what is needed).

But I cannot find any documentation on newtFormRun().
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Qt-based Tea Text Editor: Managing Image and Text Files in One Application LXer Syndicated Linux News 0 07-30-2012 07:51 PM
question about newt-devel SeRi@lDiE Slackware 7 12-12-2011 01:02 AM
join 2 text files based on first number present in every line of the 2 text files markraem Linux - Software 4 01-25-2010 06:26 AM
Remove lines in a text file based on another text file asiandude Programming 10 01-29-2009 10:59 AM
Text-based GUI hansnueski Programming 6 06-18-2005 08:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration