Does anybody know, how to check, how the selected value on the Dropdown list was changed:
- either with a mouse click on the dropdown list
- or with binded property ‘Selected Value’
I have a dropdown list with the ‘Selected Value’ property binding to the SQL query.
When the user chooses from the dropdown list, the selected value is written to the database table.
Or when the ‘ident’ and ‘idx’ in the selection query changes, the selected value is populated from a database table.
Now, every time, when the user chooses from the dropdown list, I must log that change into the log db table which means that the user has changed the value
.`
#this is on the propertyChange event of the dropdown list
if event.propertyName == "selectedValue":
### Recepture AuditLog
sufix = ""
lista = [u"ZUNANJE", u"NOTRANJE"]
staraVrednost = event.oldValue
staraVrednost = lista[staraVrednost]
novaVrednost = event.newValue
novaVrednost = lista[novaVrednost]
if staraVrednost != novaVrednost:
imeRecepture = event.source.parent.parent.parent.getComponent('lstRecepture').ime_recepture
ident = event.source.parent.parent.parent.getComponent('lstRecepture').ident
imeParametra = u'vrednost'.upper()
opisNastavitve = event.source.parent.getComponent('lblOpisNastavitve8').text.upper()
uporabnik = system.tag.read("[Client]loggedUser").value
opis = "Polje " + opisNastavitve + " je bilo spremenjeno iz " + str(staraVrednost) + " na " + str(novaVrednost)
query = "INSERT INTO recipes_auditlog (ime_recepture, ident, opis, opis_nastavitve, stara_vrednost, nova_vrednost, uporabnik) VALUES (?,?,?,?,?,?,?)"
system.db.runPrepUpdate(query, [imeRecepture, ident, opis, opisNastavitve + ", " + imeParametra, staraVrednost, novaVrednost, uporabnik])
`
But the problem is, that the change is also logged when the value is changed by the selected query.
So, how would I distinguish between one change and another?