www.mxdraw.com
内容索引主面
前一个向上下一个
MxDrawXCustomFunction::ClearMouseEvent 方法

用于js程序中,处理控件鼠标事件后,不想事件继续再被处理,就调用该函数。 例如:js

            function MouseEvent(dX,dY,lType)
            {

                if(lType == 4)
                {

                    var axMxDrawX1 = document.getElementById("MxDrawXCtrl");
                    var ss = axMxDrawX1.Call("Mx_NewSelectionSet","");
                    var pt = axMxDrawX1.Call("Mx_NewPoint","");
                    var fil = axMxDrawX1.Call("Mx_NewResbuf","");
                    pt.x = dX;
                    pt.y = dY;

                    ss.SelectAtPoint2(pt,fil);

                    if(ss.Count > 0)
                            {
                                var ent = ss.Item(0);
                                //alert("点击了" + ent.ObjectName + "对象");


                            }
                // 取消后面的命令。
                    axMxDrawX1.Call("ClearMouseEvent",0);
                    axMxDrawX1.SendStringToExecute("");
                    return 1;

                    }

                    //2是鼠标左键按下

                else if(lType == 2)
                {

                    var axMxDrawX1 = document.getElementById("MxDrawXCtrl");
                    var ss = axMxDrawX1.Call("Mx_NewSelectionSet","");
                    var pt = axMxDrawX1.Call("Mx_NewPoint","");
                    var fil = axMxDrawX1.Call("Mx_NewResbuf","");
                    pt.x = dX;
                    pt.y = dY;

                    ss.SelectAtPoint2(pt,fil);

                    if(ss.Count > 0)
                        {
                                var ent = ss.Item(0);
                                axMxDrawX1.Call("ClearMouseEvent",0);

                                if (ent.ObjectName=="McDbText")
                                {
                                        var text = ent;

                                        alert("文字内容:" + text.TextString);
                                        // 取消后面的命令。
                                        axMxDrawX1.SendStringToExecute("");
                                        return 1;
                                }
                                else if(ent.ObjectName=="McDbMText")
                                {
                                    var mtext = ent;

                                        var ret = axMxDrawX1.CallLongParam1("Mx_GetMTextContent",ent.ObjectID);


                                        alert("文字内容:" +ret.AtString(1));
                                        // 取消后面的命令。
                                        axMxDrawX1.SendStringToExecute("");
                                        return 1;
                                }


                            }


                    }


                return 0;
            }
IDL
static void ClearMouseEvent();
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!