# Understanding the Details function

**URL:** <https://forum.xojo.com/t/understanding-the-details-function/29619>\
**Category:** Getting Started\
**Created:** [February 7, 2016, 9:42pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619 "2016-02-07T21:42:34Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralph\_Alvy](https://forum.xojo.com/user_avatar/forum.xojo.com/ralph_alvy/32/4528_2.png) [@Ralph\_Alvy](https://forum.xojo.com/u/Ralph_Alvy)\
**Post date:** [February 7, 2016, 9:42pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/1 "2016-02-07T21:42:34Z")

</div>

I’m trying to understand how the Details function works with respect to KeyCode. I am using the KeyPressed event in a Web project, and in that event I have tried the following and neither of them do anything when hitting the Tab key on the relevant field:

```auto
If details.KeyCode = 9 Then
    MsgBox "Tab key pressed"
  End If
```

```auto
If details.KeyCode = details.KeyTab Then
    MsgBox "Tab key pressed"
  End If
```

I’m obviously missing something very basic here.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [February 7, 2016, 10:17pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/2 "2016-02-07T22:17:20Z")

</div>

Keycodes are NOT characters.

See [http://documentation.xojo.com/index.php/keyboard](http://documentation.xojo.com/index.php/keyboard)

Tab keycode is &h30

If you want to compare with chr(9) use Details.Character

---

<div class="post-metadata">

**Author:** ![Ralph\_Alvy](https://forum.xojo.com/user_avatar/forum.xojo.com/ralph_alvy/32/4528_2.png) [@Ralph\_Alvy](https://forum.xojo.com/u/Ralph_Alvy)\
**Post date:** [February 7, 2016, 10:49pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/3 "2016-02-07T22:49:19Z")

</div>

Thanks, Michael. I tried each of the following KeyPressed event code snippets, and neither do anything when I press Tab on the relevant field:

```auto
If details.KeyCode = &h30 Then
    MsgBox "Tab is pressed"
  End If
```

```auto
If details.Character = chr(9) Then
    MsgBox "Tab is pressed"
  End If
```

---

<div class="post-metadata">

**Author:** ![Ralph\_Alvy](https://forum.xojo.com/user_avatar/forum.xojo.com/ralph_alvy/32/4528_2.png) [@Ralph\_Alvy](https://forum.xojo.com/u/Ralph_Alvy)\
**Post date:** [February 7, 2016, 11:13pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/4 "2016-02-07T23:13:20Z")

</div>

However, if I create a test Desktop project, and do the same, but like this:

```auto
  If Keyboard.AsyncKeyDown(&h30) Then
    MsgBox "Tab is pressed"
  End If
```

It works fine when placed in the field’s KeyDown event handler. What I was trying before was with a Web project.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [February 7, 2016, 11:19pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/5 "2016-02-07T23:19:42Z")

</div>

Desktop & web behave VERY differently in many respects

With a desktop project there is 0 distance between the app and the ui - they’re on the same machine

Not so on the internet  
The UI may be running on a machine half way round the world (in the browser) and the App running on a server  
So by the time the “keypressed” event gets to the app

1. the key has already been pressed and more than likely the key released - basically far too late for you to react
2. there may be a LOT of latency between the user pressing the key & the app being notified about it (thats the nature of the internet)

Using keydown etc on the web is not recommended

---

<div class="post-metadata">

**Author:** ![Ralph\_Alvy](https://forum.xojo.com/user_avatar/forum.xojo.com/ralph_alvy/32/4528_2.png) [@Ralph\_Alvy](https://forum.xojo.com/u/Ralph_Alvy)\
**Post date:** [February 7, 2016, 11:21pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/6 "2016-02-07T23:21:53Z")

</div>

After see the result I wanted only on the Desktop version, I started to wonder if that’s what was happening. Thanks, Norman.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [February 7, 2016, 11:23pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/7 "2016-02-07T23:23:22Z")

</div>

I just tested. Tab is not detected, because it is used by the browser for its own UI.

Other keys are.

---

<div class="post-metadata">

**Author:** ![Ralph\_Alvy](https://forum.xojo.com/user_avatar/forum.xojo.com/ralph_alvy/32/4528_2.png) [@Ralph\_Alvy](https://forum.xojo.com/u/Ralph_Alvy)\
**Post date:** [February 7, 2016, 11:29pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/8 "2016-02-07T23:29:18Z")

</div>

Michel,

I tried a few other keys and none worked with the browser (Mac Chrome): ESC, 1, F1.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [February 7, 2016, 11:38pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/9 "2016-02-07T23:38:41Z")

</div>

[quote=245794:@Ralph Alvy]Michel,

I tried a few other keys and none worked with the browser (Mac Chrome): ESC, 1, F1.[/quote]

You may want to use Details.CtrlKey.

But I think you better not use control keys. Depending on the browser, they may not be available.

Try with alphanumeric keys, and your code will work.

Here is an example of code I used to test in the WebPage KeyPressed:

` system.DebugLog str(details.CtrlKey)
  system.DebugLog details.Character`

In Chrome it detects Alt, Ctrl, F1, as well as alphanumeric keys.

BUT if you are using for instance Internet Explorer, it does not detect them because IE simply does not honor the Keypressed event for control characters, arrow keys and function keys.

---

<div class="post-metadata">

**Author:** ![Ralph\_Alvy](https://forum.xojo.com/user_avatar/forum.xojo.com/ralph_alvy/32/4528_2.png) [@Ralph\_Alvy](https://forum.xojo.com/u/Ralph_Alvy)\
**Post date:** [February 8, 2016, 12:06am UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/10 "2016-02-08T00:06:54Z")

</div>

Hmmm…you’re making it more important I don’t bother with coding keypresses here. I’ll stick with things like LostFocus.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [February 8, 2016, 12:26am UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/11 "2016-02-08T00:26:45Z")

</div>

Keyboard and mouse events really should be handled client-side.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [February 8, 2016, 1:06am UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/12 "2016-02-08T01:06:27Z")

</div>

> [@245796:@Ralph Alvy](#):
>
> Hmmm…you’re making it more important I don’t bother with coding keypresses here. I’ll stick with things like LostFocus.

On the Web, navigation is primarily mouse based.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:10pm UTC](https://forum.xojo.com/t/understanding-the-details-function/29619/13 "2020-10-29T18:10:52Z")

</div>


