# Focus table after system messagebox

**URL:** <https://forum.inductiveautomation.com/t/focus-table-after-system-messagebox/22524>\
**Category:** Ignition\
**Created:** [February 12, 2019, 9:25pm UTC](https://forum.inductiveautomation.com/t/focus-table-after-system-messagebox/22524 "2019-02-12T21:25:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [February 12, 2019, 9:25pm UTC](https://forum.inductiveautomation.com/t/focus-table-after-system-messagebox/22524/1 "2019-02-12T21:25:35Z")

</div>

Hi, i need to get this to work. so i need to get a table back to focus and to the selected row after system.gui.messagebox. the operator would clear the message but i need that after the clear the table row and column are focused. so they would input again without the need to select the table again.

```
                    "selectlo=system.db.runScalarPrepQuery(QselectItemlot, [newValue, lotid])
		if selectlo != None:

			system.gui.messageBox("That Pallet was already Scanned, please choose another")

			self.data = system.dataset.deleteRow(self.data, rowIndex)
			self.selectedRow = len(system.dataset.toPyDataSet(self.data)) - 1
			def addRow():
				self.parent.getComponent('Add Row').doClick()
				self.selectedRow = len(system.dataset.toPyDataSet(self.data)) - 1
				self.selectedColumn = 0
			system.util.invokeLater(addRow) "
```

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [February 12, 2019, 9:50pm UTC](https://forum.inductiveautomation.com/t/focus-table-after-system-messagebox/22524/2 "2019-02-12T21:50:23Z")

</div>

I think you’re looking for .requestFocus(True) - use this on the table component like table.requestFocus(True), I think that should do what you want.

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [February 12, 2019, 10:08pm UTC](https://forum.inductiveautomation.com/t/focus-table-after-system-messagebox/22524/3 "2019-02-12T22:08:26Z")

</div>

thanks it’s almost correct. so after that the tables goes to focus. but not the row. even though the row it is selected. i still need to press Tab once in order to go to that row.  
any ideas?

---

<div class="post-metadata">

**Author:** ![juang](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@juang](https://forum.inductiveautomation.com/u/juang)\
**Post date:** [February 12, 2019, 10:34pm UTC](https://forum.inductiveautomation.com/t/focus-table-after-system-messagebox/22524/4 "2019-02-12T22:34:18Z")

</div>

got it to work by adding

from java.awt import Robot  
from java.awt.event import KeyEvent

robot = Robot()  
robot.keyPress(KeyEvent.VK\_TAB)
