Last active
September 26, 2015 15:13
-
-
Save mindspank/cbd243cdf4ec15f365eb to your computer and use it in GitHub Desktop.
Set listbox in alternate state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add a new alternate states to a app. | |
* Change a listbox to use this new alternate state. | |
*/ | |
var qsocks = require('qsocks') | |
qsocks.Connect({appname: 'Sales Discovery.qvf'}) | |
.then(function(global) { | |
return global.openDoc('Sales Discovery.qvf') | |
}) | |
.then(function(app) { | |
//Add a new alternate state to the app. | |
app.addAlternateState('MyNewState').then(function() { | |
//Fetch a generic object, in this case a listbox. | |
return app.getObject('QEECN').then(function(object) { | |
//Set the objects qListObjectDef to use our new alternate state | |
return object.applyPatches([{ | |
"qPath": '/qListObjectDef/qStateName', | |
"qOp": 'add', | |
"qValue": '"MyNewState"' | |
}]) | |
}) | |
}) | |
.then(function() { | |
//Persist changes | |
app.doSave(); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment