Tuesday, July 19, 2011

Sencha - textfield



First, make a Textfield and a Button under a FormPanel including a FieldSet (which is for a layout).
FormPanel should have an autoRef (e.g., fileSaveForm) for this code (MainPanel.js)

The 'fileSaveButton' is an autoRef of the 'Save Project Preset' button.
'fileSaveField' is an autoRef of the textfield.


this.fileSaveButton.on('click', this.onSubmitClick.createCallback(this, this.fileSaveForm, false));
this.fileSaveButton.on('click', this.delayRefreshAllTrees, this);

Finally, when a user clicks the button, the fileSaveForm is invoked
and somehow the textfield under the formpanel is invoked as well.
Then, a text message (written by the user) is transferred to python scripts using a callback function.
mk:@MSITStore:C:\Program%20Files%20(x86)\WorldViz\Vizard4\help\Vizard.chm::/vizhtml_collecting_form_data.htm




On the other hand, when you display something from python to Sencha,  we can call data as follows. 
Of course, somehow we need to register JSON.
vizhtml.registerCode("check-nodes.json",items,isFile=True)

    initComponent: function() {
            this.on('click', this.onClick, this);
    },
    onClick: function(node){
        if (node.isLeaf()) {
            this.updatePreview(node);
        }
    },
    updatePreview: function(node) {
        Ext.getCmp('fileSaveField').setValue(node.attributes.file_location);
    }

No comments:

Post a Comment