Provides data for an input character request event.
Inheritance: System.EventArgs
示例#1
0
 private void vm_KeyWanted(object sender, KeyWantedEventArgs e)
 {
     e.Char = entry[0];
 }
示例#2
0
        private uint glk_select(uint[] args)
        {
            DeliverOutput();

            if (glkWantLineInput)
            {
                string line;
                if (LineWanted == null)
                {
                    line = "";
                }
                else
                {
                    LineWantedEventArgs e = new LineWantedEventArgs();
                    LineWanted(this, e);
                    line = e.Line;
                }

                byte[] bytes = StringToLatin1(line);
                uint max = Math.Min(glkLineInputBufSize, (uint)bytes.Length);
                for (uint i = 0; i < max; i++)
                    image.WriteByte(glkLineInputBuffer + i, bytes[i]);

                // return event
                GlkWriteReference(
                    args[0],
                    GlkConst.evtype_LineInput, 1, max, 0);

                glkWantLineInput = false;
            }
            else if (glkWantCharInput)
            {
                char ch;
                if (KeyWanted == null)
                {
                    ch = '\0';
                }
                else
                {
                    KeyWantedEventArgs e = new KeyWantedEventArgs();
                    KeyWanted(this, e);
                    ch = e.Char;
                }

                // return event
                GlkWriteReference(
                    args[0],
                    GlkConst.evtype_CharInput, 1, ch, 0);

                glkWantCharInput = false;
            }
            else
            {
                // no event
                GlkWriteReference(
                    args[0],
                    GlkConst.evtype_None, 0, 0, 0);
            }

            return 0;
        }
示例#3
0
        private char InputChar()
        {
            // can't do anything without this event handler
            if (KeyWanted == null)
                return '\0';

            KeyWantedEventArgs keyArgs = new KeyWantedEventArgs();
            //CancelEventArgs waitArgs = new CancelEventArgs();

            // ask the application to read a character
            KeyWanted(this, keyArgs);
            return keyArgs.Char;
        }
示例#4
0
 private void vm_KeyWanted(object sender, KeyWantedEventArgs e)
 {
     e.Char = command[0];
 }