Write 2 diff values of the same property inside a script

I try to write a property of a component to the value 1
on the start of a button action performed script,
and to the value 0 at the end.

This component is used for displaying a wait message.

The value stay to 0, and the message is not displayed.
Is it possible to write 2 different values of the same property, or of a same client tag,
inside the same script ?

Are those 0 and 1 values the value that determines if the message is showing or not? Are you trying to display the wait message for a set period of time? What exactly are you trying to do with the message box?

Yes the value determine if the label message is visible or not, the code is the following :

[code]import app.commun
import app.bdd
import system

event.source.parent.getComponent(‘LabelWait’).visible = 1
event.source.componentEnabled=0

liste des tables PG

sql = “SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where table_type=‘TABLE’ order by TABLE_NAME asc”
result = system.db.runQuery(sql,dbfrontal)

listeCpt = []
for res in result:
nom_table = res[0]
cpt = system.db.runScalarQuery("SELECT COUNT(*) FROM " + nom_table,dbfrontal)
listeCpt.append([nom_table,cpt]);

sql = “SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where table_type=‘VIEW’ order by TABLE_NAME asc”
result = system.db.runQuery(sql,dbfrontal)
for res in result:
nom_table = res[0]
listeCpt.append([nom_table,0]);

headers = [“Table”, “Nombre Enregistrements”]
result = system.dataset.toDataSet(headers,listeCpt)
event.source.parent.getComponent(‘Table’).data = result

event.source.componentEnabled=1
event.source.parent.getComponent(‘LabelWait’).visible = 0[/code]

import system

event.source.parent.getComponent('LabelWait').visible = 1
event.source.componentEnabled=0

... long duration process....

event.source.componentEnabled=1
event.source.parent.getComponent('LabelWait').visible = 0

I do this in two parts. In the action script attached to the button I change the cursor to the wait one first and then I call the long running script.

At the end of the script I restore the cursor with system.util.invokeLater()

Thanks Robert.

I found a similar solution in the doc :

[code]def longProcess(rootContainer = event.source.parent):

import system

# Now we'll send our results back to the UI
def sendBack(result = result,rootContainer = rootContainer):
	import system		
	rootContainer.getComponent('Table').data = result
	system.tag.write("[Client]busy",0)
system.util.invokeLater(sendBack)

system.tag.write("[Client]busy",1)
system.util.invokeAsynchronous(longProcess)[/code]

the only drawback is the use of sendback method which is a bit tricky to integrate in existing code

Yeah, I was going to suggest invokeAsynchronous/invokeLater - essential if you’re trying to work with both long-running tasks and the UI.