Skip to content

Commit

Permalink
Document various text input box natives (#1111)
Browse files Browse the repository at this point in the history
* Document various text input box natives

Added parameters, real names, etc.

* Add example to DisplayOnscreenKeyboard

* Add a table to UPDATE_ONSCREEN_KEYBOARD

* Update DisplayOnscreenKeyboardWithLongerInitialString.md

Change `Any*` to `AnyPtr` `cs_type` declaration.

* Use enum in NextOnscreenKeyboardResultWillDisplayUsingTheseFonts

* use enum in DisplayOnscreenKeyboard.

* Use enum in UpdateOnscreenKeyboard

* Use consistent casing for enums

---------

Co-authored-by: ammonia-cfx <[email protected]>
Co-authored-by: Dillon Skaggs <[email protected]>
  • Loading branch information
3 people authored Aug 8, 2024
1 parent f40be99 commit a0e27fd
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 92 deletions.
8 changes: 3 additions & 5 deletions HUD/ForceCloseTextInputBox.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
ns: HUD
aliases: ["0x8817605C2BA76200"]
aliases: ["0x8817605C2BA76200", "_FORCE_CLOSE_TEXT_INPUT_BOX"]
---
## _FORCE_CLOSE_TEXT_INPUT_BOX
## FORCE_CLOSE_TEXT_INPUT_BOX

```c
// 0x8817605C2BA76200
void _FORCE_CLOSE_TEXT_INPUT_BOX();
void FORCE_CLOSE_TEXT_INPUT_BOX();
```


17 changes: 0 additions & 17 deletions HUD/N_0x1185a8087587322c.md

This file was deleted.

14 changes: 0 additions & 14 deletions HUD/N_0x577599cced639ca2.md

This file was deleted.

16 changes: 16 additions & 0 deletions HUD/SetAllowCommaOnTextInput.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
ns: HUD
aliases: ["0x577599CCED639CA2"]
---
## SET_ALLOW_COMMA_ON_TEXT_INPUT

```c
// 0x577599CCED639CA2
void SET_ALLOW_COMMA_ON_TEXT_INPUT(cs_type(Any) BOOL allow);
```
**NOTE:** This must be called before you open the text input box.
## Parameters
* **allow**: Toggles if the comma can be used in conjuction with the `filename` text input box type.
16 changes: 16 additions & 0 deletions HUD/SetTextInputBoxEnabled.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
ns: HUD
aliases: ["0x1185A8087587322C"]
---
## SET_TEXT_INPUT_BOX_ENABLED

```c
// 0x1185A8087587322C
void SET_TEXT_INPUT_BOX_ENABLED(BOOL state);
```
Toggles if the text input box can be opened with [`DISPLAY_ONSCREEN_KEYBOARD`](#_0x00DC833F2568DBF6).
## Parameters
* **state**:
15 changes: 7 additions & 8 deletions MISC/CancelOnscreenKeyboard.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
---
ns: MISC
aliases: ["0x58A39BE597CE99CD"]
aliases: ["0x58A39BE597CE99CD", "_CANCEL_ONSCREEN_KEYBOARD"]
---
## _CANCEL_ONSCREEN_KEYBOARD
## CANCEL_ONSCREEN_KEYBOARD

```c
// 0x58A39BE597CE99CD 0x196444BB
void _CANCEL_ONSCREEN_KEYBOARD();
void CANCEL_ONSCREEN_KEYBOARD();
```

```
DO NOT use this as it doesn't clean up the text input box properly and your script will get stuck in the UPDATE_ONSCREEN_KEYBOARD() loop.
Use _FORCE_CLOSE_TEXT_INPUT_BOX instead.
CANCEL_*
```
Closes the onscreen keyboard on console versions of the game.

**NOTE:** Do not use this native in FiveM/PC, because [`UPDATE_ONSCREEN_KEYBOARD`](#_0x0CF2B696BBF945AE) value doesn't get cleaned up and stays as `0`.
You should use [`FORCE_CLOSE_TEXT_INPUT_BOX`](#_0x8817605C2BA76200) instead.
72 changes: 40 additions & 32 deletions MISC/DisplayOnscreenKeyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,53 @@ ns: MISC

```c
// 0x00DC833F2568DBF6 0xAD99F2CE
void DISPLAY_ONSCREEN_KEYBOARD(int p0, char* windowTitle, char* p2, char* defaultText, char* defaultConcat1, char* defaultConcat2, char* defaultConcat3, int maxInputLength);
void DISPLAY_ONSCREEN_KEYBOARD(int keyboardType, char* windowTitle, char* description, char* defaultText, char* defaultConcat1, char* defaultConcat2, char* defaultConcat3, int maxInputLength);
```
Displays a text input box.
```
windowTitle's
-----------------
CELL_EMAIL_BOD = "Enter your Eyefind message"
CELL_EMAIL_BODE = "Message too long. Try again"
CELL_EMAIL_BODF = "Forbidden message. Try again"
CELL_EMAIL_SOD = "Enter your Eyefind subject"
CELL_EMAIL_SODE = "Subject too long. Try again"
CELL_EMAIL_SODF = "Forbidden text. Try again"
CELL_EMASH_BOD = "Enter your Eyefind message"
CELL_EMASH_BODE = "Message too long. Try again"
CELL_EMASH_BODF = "Forbidden message. Try again"
CELL_EMASH_SOD = "Enter your Eyefind subject"
CELL_EMASH_SODE = "Subject too long. Try again"
CELL_EMASH_SODF = "Forbidden Text. Try again"
FMMC_KEY_TIP10 = "Enter Synopsis"
FMMC_KEY_TIP12 = "Enter Custom Team Name"
FMMC_KEY_TIP12F = "Forbidden Text. Try again"
FMMC_KEY_TIP12N = "Custom Team Name"
FMMC_KEY_TIP8 = "Enter Message"
FMMC_KEY_TIP8F = "Forbidden Text. Try again"
FMMC_KEY_TIP8FS = "Invalid Message. Try again"
FMMC_KEY_TIP8S = "Enter Message"
FMMC_KEY_TIP9 = "Enter Outfit Name"
FMMC_KEY_TIP9F = "Invalid Outfit Name. Try again"
FMMC_KEY_TIP9N = "Outfit Name"
PM_NAME_CHALL = "Enter Challenge Name"
enum eKeyboardType
{
ONSCREEN_KEYBOARD_ENGLISH = 0,
ONSCREEN_KEYBOARD_LOCALISED = 1,
ONSCREEN_KEYBOARD_PASSWORD = 2,
ONSCREEN_KEYBOARD_GAMERTAG = 3,
ONSCREEN_KEYBOARD_EMAIL = 4,
ONSCREEN_KEYBOARD_BASIC_ENGLISH = 5,
ONSCREEN_KEYBOARD_FILENAME = 6
};
```
## Parameters
* **p0**:
* **windowTitle**:
* **p2**:
* **defaultText**:
* **keyboardType**: See the list above. Default is `0`.
* **windowTitle**: Text label for the title of the box.
* **description**: Has no use on PC.
* **defaultText**: Default text that is written in the input field.
* **defaultConcat1**:
* **defaultConcat2**:
* **defaultConcat3**:
* **maxInputLength**:
* **maxInputLength**: Max number of characters that can be typed (2 - 256).
## Examples
```lua
AddTextEntry("my_input_title", "Enter something cool:")
DisplayOnscreenKeyboard(0, "my_input_title", "", "", "", "", "", 30) -- Show the text input box
while UpdateOnscreenKeyboard() == 0 do Wait(0) end -- Wait for the user to stop editing
-- This block of code is reached after the user is done editing
local inputUpdate = UpdateOnscreenKeyboard()
if inputUpdate == 1 then -- User hit OK in the text input box
local result = GetOnscreenKeyboardResult()
print("You wrote this in the input box:", result)
elseif inputUpdate == 2 then
print("You canceled the input!")
else -- -1 or 3
print("An error has occurred")
end
```
14 changes: 8 additions & 6 deletions MISC/DisplayOnscreenKeyboardWithLongerInitialString.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ aliases: ["0xCA78CFA0366592FE","_DISPLAY_ONSCREEN_KEYBOARD_2"]

```c
// 0xCA78CFA0366592FE 0xD2688412
void DISPLAY_ONSCREEN_KEYBOARD_WITH_LONGER_INITIAL_STRING(int p0, char* windowTitle, Any* p2, char* defaultText, char* defaultConcat1, char* defaultConcat2, char* defaultConcat3, char* defaultConcat4, char* defaultConcat5, char* defaultConcat6, char* defaultConcat7, int maxInputLength);
void DISPLAY_ONSCREEN_KEYBOARD_WITH_LONGER_INITIAL_STRING(int keyboardType, char* windowTitle, cs_type(AnyPtr) char* description, char* defaultText, char* defaultConcat1, char* defaultConcat2, char* defaultConcat3, char* defaultConcat4, char* defaultConcat5, char* defaultConcat6, char* defaultConcat7, int maxInputLength);
```
Displays the text input box with support for input with 500 characters.
## Parameters
* **p0**:
* **windowTitle**:
* **p2**:
* **defaultText**:
* **keyboardType**: See [`DISPLAY_ONSCREEN_KEYBOARD`](#_0x00DC833F2568DBF6)
* **windowTitle**: Text label of the window title.
* **description**: Unused on PC.
* **defaultText**: Default text that is written in the input field.
* **defaultConcat1**:
* **defaultConcat2**:
* **defaultConcat3**:
* **defaultConcat4**:
* **defaultConcat5**:
* **defaultConcat6**:
* **defaultConcat7**:
* **maxInputLength**:
* **maxInputLength**: Value between 2 - 500.
18 changes: 14 additions & 4 deletions MISC/NextOnscreenKeyboardResultWillDisplayUsingTheseFonts.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@ aliases: ["0x3ED1438C1F5C6612"]

```c
// 0x3ED1438C1F5C6612 0x3301EA47
void NEXT_ONSCREEN_KEYBOARD_RESULT_WILL_DISPLAY_USING_THESE_FONTS(int p0);
void NEXT_ONSCREEN_KEYBOARD_RESULT_WILL_DISPLAY_USING_THESE_FONTS(int fontBitField);
```
```
p0 was always 2 in R* scripts.
Called before calling DISPLAY_ONSCREEN_KEYBOARD if the input needs to be saved.
enum eFontBitField
{
FONT_BIT_STANDARD = 1,
FONT_BIT_CURSIVE = 2,
FONT_BIT_ROCKSTAR_TAG = 4
FONT_BIT_LEADERBOARD = 8
FONT_BIT_CONDENSED = 16
FONT_BIT_FIXED_WIDTH_NUMBERS = 32
FONT_BIT_CONDENSED_NOT_GAMERNAME = 64
FONT_BIT_PRICEDOWN = 128
};
```
## Parameters
* **p0**:
* **fontBitField**: See the list above.
17 changes: 11 additions & 6 deletions MISC/UpdateOnscreenKeyboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ ns: MISC
int UPDATE_ONSCREEN_KEYBOARD();
```

Returns the current state of the text input box.

```
Returns the current status of the onscreen keyboard, and updates the output.
Status Codes:
-1: Keyboard isn't active
0: User still editing
1: User has finished editing
2: User has canceled editing
enum eOSKStatus
{
OSK_INVALID = -1,
OSK_PENDING = 0,
OSK_SUCCESS = 1,
OSK_CANCELLED = 2,
OSK_FAILED = 3
};
```

## Return value
Returns a value from the list above.

0 comments on commit a0e27fd

Please sign in to comment.