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? |
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. |
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 |
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. |
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. |
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. |