Im trying to make a new module to aid in using system.nav.openWindowInstance. Im trying to prevent Bubba form opening 18 copies of the same window, with the same instance id. Here is what i have so far
[code]def checkInstance(window,instanceId):
import system
instances = system.tag.getTagValue("[client]WindowInstances")
for row in range(instances.rowCount):
if instances.getValueAt(row,"Window") == window and instances.getValueAt(row,"InstanceId") == instanceId:
return row
return -1
def addInstance(window,instanceId):
import system
instances = system.tag.getTagValue("[client]WindowInstances")
newRow = [window,instanceId]
system.tag.writeToTag("[client]WindowInstances",system.dataset.addRow(instances,newRow))
def delInstance(window,instanceId):
import system,app.helper
row = helper.checkInstance(window,instanceId)
instances = system.tag.getTagValue("[client]WindowInstances")
system.tag.writeToTag("[client]WindowInstances",system.dataset.deleteRow(instances,row))
[/code]
Lets say it is called as follows
if checkInstance("Transmitter",event.source.Tag) == -1:
addInstance("Transmitter",event.source.Tag)
import fpmi
fpmi.nav.openWindowInstance('Transmitter', {'Tag' : event.source.Tag, 'config':event.source.config})
fpmi.nav.centerWindow('Transmitter')
else:
***code to bring instance to front***
In the else statement, how do I âgetâ the instance I want. I store a dataset of open instances in a client tag. Can we add an api reference to return some sort of ID when we use system.nav.openWindowInstance?