# Alarm Status Table change height at runtime

**URL:** <https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [March 4, 2019, 1:04am UTC](https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019 "2019-03-04T01:04:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 4, 2019, 1:04am UTC](https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019/1 "2019-03-04T01:04:09Z")

</div>

We’re trying to toggle between single line (no header, no footer, marquee mode–all handled by bindings) and full table at runtime with the code below. However, it produces no errors and… has no effect.

```auto
if event.propertyName == 'expand':
	from java.awt import Dimension
	alarmTable = event.source.parent.getComponent('Alarm Status Table')
	if event.newValue == True:
		dim = Dimension(573,200)
	else:
		dim = Dimension(573,20)
	alarmTable.setSize(dim)

```

Is there a way to do this other than creating two alarm status tables and swapping visibility, or is that the way to go?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 4, 2019, 12:40pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019/2 "2019-03-04T12:40:17Z")

</div>

Try using [system.gui.transform()](https://docs.inductiveautomation.com/display/DOC79/system.gui.transform). Ignition’s look & feel is responsible for actually calling setSize() after setting the L&F so it’ll actually work.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [March 4, 2019, 12:40pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019/3 "2019-03-04T12:40:30Z")

</div>

system.gui.transform(alarmTable,newHeight=20)  
system.gui.transform(alarmTable,newHeight=200)

Should do what you are looking for.

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [March 4, 2019, 12:41pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019/4 "2019-03-04T12:41:07Z")

</div>

Ha! Phil beat me by like 30 seconds 😛

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 4, 2019, 3:30pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019/5 "2019-03-04T15:30:20Z")

</div>

Thanks @pturmel & @MMaynard. I _knew_ I was missing something obvious; no need to dig into Java here.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [March 5, 2019, 5:42pm UTC](https://forum.inductiveautomation.com/t/alarm-status-table-change-height-at-runtime/23019/6 "2019-03-05T17:42:21Z")

</div>

Here’s the script I ended up with on the alarm status table with custom property `expand`. Using the notes area it was necessary to change it and footer panel in the script (rather than bindings) and use invokeLater for the height change. Otherwise when contracted the footer would still be showing (and the only thing showing given the single row height when retracted).

```python
# Toggle alarm table size.
if event.propertyName == 'expand':
	expand = event.newValue
	# Show notes area on north when expanded. Else hide it.
	event.source.notesAreaLocation = 5 if expand else -1
	# Show footer when expanded.
	event.source.showFooterPanel = True if expand else False
	# Expand/contract.
	def setHeight():
		newHeight = 300 if expand else 20
		system.gui.transform(event.source, newHeight=newHeight, duration=300, acceleration=system.gui.ACCL_FAST_TO_SLOW)
	system.util.invokeLater(setHeight)

```

Alarm status table refreshes its data with these property changes, so there’s a delay between expand/retract and redisplaying data, but it’s not too bad if the refresh rate is low enough. Interestingly, each refresh bumps CPU usage up noticeably (~10%) for a moment in Designer, though there is no noticeable CPU bump for this running in client running on same computer.
