public static List <SciterElement> TreeNavigateTo(SciterElement origin_el, bool tree_nav) { Debug.Assert(origin_el != null); List <SciterElement> elstack = new List <SciterElement>(); List <uint> uidstack = new List <uint>(); List <string> tagnames = new List <string>(); SciterElement el_it = origin_el; do { elstack.Add(el_it); tagnames.Add(el_it.TagName()); uidstack.Add(el_it.UID); var el_parent = el_it.Parent; if (el_parent == null) { return(null); } el_it = el_parent; } while(el_it._he != State.g_el_frameroot._he); uidstack.Reverse(); tagnames.Reverse(); SciterValue sv_uid = new SciterValue(origin_el.UID); SciterValue sv_uidstack = SciterValue.FromList(uidstack); SciterValue sv_tagnames = SciterValue.FromList(tagnames); if (tree_nav) { dbg_on_navigate = true; el_tree.CallMethod("NavigateToPath", sv_uid, sv_uidstack); // does not generate Event.SELECT_SELECTION_CHANGED dbg_on_navigate = false; } WidgetTreePath.Instance.RecreateTagPath(origin_el.UID, uidstack, tagnames); SciterValue sv_details = Inspecting.ElemDetails(); if (sv_details != null && !sv_details.IsUndefined) // happens while waiting for CONTENT_CHANGED arriving { el_tree.CallMethod("RenderDetails", sv_details); } return(elstack); }
protected override bool OnScriptCall(SciterElement se, string name, SciterValue[] args, out SciterValue result) { result = null; switch (name) { case "Host_OnOptionSelect": { Debug.Assert(dbg_on_navigate == false); uint uid = (uint)el_tree.Value.Get(0); SciterElement el_origin = App.AppWindow.ElementByUID(uid); Inspecting.PageElemInspect(el_origin, false); return(true); } case "Host_OnOptionDelete": { uint uid = (uint)el_tree.Value.Get(0); SciterElement el_origin = App.AppWindow.ElementByUID(uid); if (el_origin != State.g_el_frameroot[0]) // not allowed to delete <html> { el_origin.Delete(); } Inspecting.PageElemRemoveHighlight(); // avoids an A/V return(true); } case "Host_OnOptionHover": { uint uid = (uint)args[0].Get(0); SciterElement el_origin = App.AppWindow.ElementByUID(uid); if (el_origin != null) // happens when deleting element and the mouse is over it in the DOM tree { Inspecting.PageElemHighlight(el_origin); } return(true); } case "Host_OnEndHover": Inspecting.PageElemRemoveHighlight(); return(true); case "Host_OnTagPathClick": el_tree.Value = args[0]; el_tree.SendEvent((uint)SciterXBehaviors.BEHAVIOR_EVENTS.SELECT_SELECTION_CHANGED); return(true); } return(false); }