LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   newt text based UI (https://www.linuxquestions.org/questions/linux-newbie-8/newt-text-based-ui-4175452401/)

LQ123 03-02-2013 10:42 AM

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?

goumba 03-03-2013 05:19 AM

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.

LQ123 03-04-2013 12:55 AM

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

goumba 03-04-2013 06:02 AM

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.

pan64 03-04-2013 06:21 AM

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.

LQ123 03-04-2013 07:09 AM

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().


All times are GMT -5. The time now is 08:37 PM.