Hi, I develop MapWinGis with Powerbuilder 12.5. I try to select shape with click in map project and show the attribute and edit it. And so save it. But i stuck with this code. Because this code was return true, but no array value.
Contstant Int INCLUSION = 1
Int li_postX, li_postY, li_stsConnect, li_stslayer
Long ll_result[], ll_shapes[]
Double ldb_projX1 = 0.0, ldb_projY1 = 0.0, ldb_projX2 = 0.0, ldb_projY2 = 0.0, ldb_postX, ldb_postY
Boolean lb_stsSelectshp
String ls_selected[]
Object result
// This script is mousedownevent. After shapefile open and shapeedittable attribute script.
SetNull(result)
IF ii_adaextent < 0 Then
Else
li_stslayer = ole_map.object.LayerHandle(0)
io_shapeObj = ole_map.object.ShapeFile(li_stslayer)
IF IsNull(io_shapeObj) Then
Else
li_postX = This.PointerX()
li_postY = This.PointerY()
li_postX = UnitsToPixels(li_postX, XUnitsToPixels!)
li_postY = UnitsToPixels(li_postY, YUnitsToPixels!)
ldb_postX = Double(li_postX)
ldb_postY = Double(li_postY)
io_selectmode = Create OleObject
io_extents = Create OleObject
ii_adaextent = io_extents.ConnectToNewObject("MapwinGIS.Extents")
IF ii_adaextent < 0 THEN
DESTROY io_extents
MessageBox("Connecting to COM Extents Failed", "Error: " + String(li_stsConnect))
Return
END IF
ole_map.Object.PixelToProj(ocx_x - 10, ocx_y + 10, ref ldb_projX1, ref ldb_projY1)
ole_map.Object.PixelToProj(ocx_x + 10, ocx_x - 10, ref ldb_projX2, ref ldb_projY2)
io_extents = Create OleObject
ii_adaextent = io_extents.ConnectToNewObject("MapwinGIS.Extents")
IF ii_adaextent < 0 THEN
DESTROY io_extents
MessageBox("Connecting to COM Extents Failed", "Error: " + String(li_stsConnect))
Return
END IF
io_extents.SetBounds(ldb_projX1, ldb_projY1, 0.0, ldb_projX1, ldb_projY1, 0.0)
// ====== This script was return true, but ll_result[] is empty. Just return ll_result[0]. No fill. Why ?
lb_stsSelectshp = io_shapeObj.SelectShapes( io_extents, 0.0, INCLUSION, ref ll_result[] )
IF lb_stsSelectshp Then
// ll_shapes[] = io_selectmode
IF IsNull(ll_shapes[]) Then
Return
End IF
IF upperBound(ll_shapes[]) > 1 Then
MB('More than one shapes were selected. Shape indices:')
Else
MB("Liat errornya : " + io_shapeObj.ErrorMsg[io_shapeObj.LastErrorCode])
io_shapeObj.ShapeSelected(ll_shapes[0], true)
MB(string(il_shapeindex))
End IF
Else
MB("Liat errornya : " + io_shapeObj.ErrorMsg[io_shapeObj.LastErrorCode])
End IF
End IF
End IF
I don't know why the ll_result[] is empty. The SelectShapes script is success with return true. Please help me an thank you for your best answer.