سؤال

stdin.getc() waits for the user to hit enter before reading from the console. Is there any functionality in vala to grab keys as they are pressed?

هل كانت مفيدة؟

المحلول

This isn't provided in C, so there is no direct means in Vala. The best solution is to uses the Curses library and the binding for Curses.getch().

Your alternative is to fiddle with the tcgetattr, which is in Vala's posix library, as per this Stack Overflow post.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top