# cmAddShape mode can't add shape

**URL:** <https://mapwindow.discourse.group/t/cmaddshape-mode-cant-add-shape/876>\
**Category:** MapWinGIS\
**Created:** [January 21, 2021, 1:41am UTC](https://mapwindow.discourse.group/t/cmaddshape-mode-cant-add-shape/876 "2021-01-21T01:41:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zcwbnu](https://avatars.discourse-cdn.com/v4/letter/z/3da27b/32.png) [@zcwbnu](https://mapwindow.discourse.group/u/zcwbnu)\
**Post date:** [January 21, 2021, 1:41am UTC](https://mapwindow.discourse.group/t/cmaddshape-mode-cant-add-shape/876/1 "2021-01-21T01:41:29Z")

</div>

I have set the map to AddShape mode ， set shapefile InteractiveEditing property as true and set layerHandle in ChooseLayerMap function.  
I see have entered AddShape mode, but nothing happens when I click the mouse.Every time left-click on the map, I will enter the ChooselayerMap function. According to the documentation, enter this function only on the first left-click, I was very confused.

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [January 24, 2021, 4:56am UTC](https://mapwindow.discourse.group/t/cmaddshape-mode-cant-add-shape/876/2 "2021-01-24T04:56:51Z")

</div>

Hello @zcwbnu

One of these days I’m gonna have to get more familiar with the built-in editing. I’ve always written custom editing since you have more control over the behavior.

I presume that you are handling the ChooseLayer function by specifying the layer handle of the layer you want to edit?

```
e.LayerHandle = myLayerHandle;
```

---

<div class="post-metadata">

**Author:** ![zcwbnu](https://avatars.discourse-cdn.com/v4/letter/z/3da27b/32.png) [@zcwbnu](https://mapwindow.discourse.group/u/zcwbnu)\
**Post date:** [January 27, 2021, 1:58am UTC](https://mapwindow.discourse.group/t/cmaddshape-mode-cant-add-shape/876/3 "2021-01-27T01:58:42Z")

</div>

Thank you for you reply@jerryfaust. Yes,I specified the layer handle of the layer.  
When I manually call AddPoint(), the AddShape Tool works, however, call GetValidatedShape() return NULL. I don’t know why the SHAPE I created by tool is invalid.

---

<div class="post-metadata">

**Author:** ![zcwbnu](https://avatars.discourse-cdn.com/v4/letter/z/3da27b/32.png) [@zcwbnu](https://mapwindow.discourse.group/u/zcwbnu)\
**Post date:** [January 27, 2021, 5:23am UTC](https://mapwindow.discourse.group/t/cmaddshape-mode-cant-add-shape/876/4 "2021-01-27T05:23:18Z")

</div>

I have add the shape, and savechanges() is OK ,but I can’t see the saved shape,Where did I save it？I have add the shapefie to map and redraw map.  
m\_se-\>AddPoint(m\_pt);  
m\_sf-\>PutInteractiveEditing(-1);  
tkEditorState es = m\_se-\>GetEditorState();  
VARIANT\_BOOL b= m\_se-\>SaveChanges();//return true  
m\_shp = m\_se-\>GetValidatedShape();//return null  
m\_se-\>Clear();

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 10, 2022, 3:41pm UTC](https://mapwindow.discourse.group/t/cmaddshape-mode-cant-add-shape/876/5 "2022-01-10T15:41:13Z")

</div>

Is this still an issue or did you solve it by now?
