コード例 #1
0
 public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
 {
     ScriptDomain.CurrentDomain.PauseKeyboardEvents(true);
     InputArgument[] arguments = new InputArgument[] { true, windowTitle.ToString(), string.Empty, defaultText, string.Empty, string.Empty, string.Empty, maxLength + 1 };
     Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, arguments);
     while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD, Array.Empty <InputArgument>()) == 0)
     {
         Script.Yield();
     }
     ScriptDomain.CurrentDomain.PauseKeyboardEvents(false);
     return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT, Array.Empty <InputArgument>()));
 }
コード例 #2
0
        /// <summary>
        /// Creates an input box for enabling a user to input text using the keyboard
        /// </summary>
        /// <param name="windowTitle">The Title of the Window.</param>
        /// <param name="defaultText">The default text.</param>
        /// <param name="maxLength">The maximum length of input allowed</param>
        /// <returns>The <see cref="string"/> of what the user entered, If the user cancelled <see cref="string.Empty"/> is returned</returns>
        public static string GetUserInput(WindowTitle windowTitle, string defaultText, int maxLength)
        {
            Input.PauseKeyboardEvents(true);

            // int p0, char* windowTitle, char* p2, char* defaultText, char* defaultConcat1, char* defaultConcat2, char* defaultConcat3, int maxInputLength
            Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, true, windowTitle.ToString(), string.Empty, defaultText, string.Empty, string.Empty, string.Empty, maxLength + 1);

            while (Function.Call <int>(Hash.UPDATE_ONSCREEN_KEYBOARD) == 0)
            {
                Script.YieldExecuting();
            }

            Input.PauseKeyboardEvents(false);

            return(Function.Call <string>(Hash.GET_ONSCREEN_KEYBOARD_RESULT));
        }
コード例 #3
0
 private static void ClearKeyboard(WindowTitle windowTitle, string defaultText, int maxLength)
 {
     API.DisplayOnscreenKeyboard(1, windowTitle.ToString(), null, defaultText, null, null, null, maxLength + 1);
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: fivmp/fivmp-not-fivem
 private static void ClearKeyboard(WindowTitle windowTitle, string defaultText, int maxLength)
 {
     Function.Call(Hash.DISPLAY_ONSCREEN_KEYBOARD, true, windowTitle.ToString(), MemoryAccess.NullString, defaultText, MemoryAccess.NullString, MemoryAccess.NullString, MemoryAccess.NullString, maxLength + 1);
 }