Programmatically change drawing tool

731
1
04-01-2012 01:18 PM
GrantCarroll
New Contributor
Hi all

I'm creating an app that will be used exclusively with touch devices, the app will be used to edit point and line features in the field. What I would like to do is have the line feature edit tool default to the free hand tool, i'm not quite sure how to do this though. I am using a template picker so that the users can select which type of feature they are creating, can I set the drawing tool when the template is selected as below ?

 dojo.connect(templatePicker, "onSelectionChange", function () {
                var selected = templatePicker.getSelected();
                if (selected) {
                  $('#featuresDialog').dialog('close');
                  selected.template.drawingTool = 'esri.layers.FeatureTemplate.TOOL_FRREEHAND';
                  updateTitle("Current template: " + $('#webmapTitle').html(selected.template.name));
                }
            });


Do i have the correct syntax ? As when i do this the tool is still defaulted to the normal line drawing tool.

Thanks in advance

Grant
0 Kudos
1 Reply
GrantCarroll
New Contributor
I solved this when looking through some of the samples.

Correct code is below

dojo.connect(templatePicker, "onSelectionChange", function () {
                var selected = templatePicker.getSelected();
                if (selected) {
                  $('#featuresDialog').dialog('close');
                 selected.template.drawingTool = 'esriFeatureEditToolFreehand'
                  updateTitle("Current template: " + selected.template.name);
                }
            });
0 Kudos