LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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, 11: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, 06:19 AM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Debian Sid. Arch. In the process of converting to and learning FreeBSD
Posts: 1,023
Blog Entries: 6

Rep: Reputation: 237Reputation: 237Reputation: 237
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, 01: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, 07:02 AM   #4
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Debian Sid. Arch. In the process of converting to and learning FreeBSD
Posts: 1,023
Blog Entries: 6

Rep: Reputation: 237Reputation: 237Reputation: 237
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, 07:21 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
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, 08: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:51 PM
question about newt-devel SeRi@lDiE Slackware 7 12-12-2011 02: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 07:26 AM
Remove lines in a text file based on another text file asiandude Programming 10 01-29-2009 11:59 AM
Text-based GUI hansnueski Programming 6 06-18-2005 09:46 AM


All times are GMT -5. The time now is 04:47 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration