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 OnEvent(SciterElement sourceElement, SciterElement targetElement, BehaviorEvents type, IntPtr reason, SciterValue data, string eventName) { switch (type) { case BehaviorEvents.ElementExpanded: expandOption(targetElement); targetElement.CallMethod("optionExpanded", targetElement.Value); return(true); case BehaviorEvents.ElementCollapsed: collapseOption(targetElement); targetElement.CallMethod("optionCollapsed", targetElement.Value); return(true); } return(base.OnEvent(sourceElement, targetElement, type, reason, data, eventName)); }
public static SciterValue ElemDetails() { if (in_content_change) { return(null); } SciterElement el = g_el_inspected; SciterValue r = new SciterValue(); r["applied_rules"] = el.CallMethod("_applied_style_rules_"); r["used_style"] = el.CallMethod("_used_style_properties_"); r["states"] = new SciterValue((int)el.State); //import std.stdio; writeln("_applied_style_rules_ ", v1.to_string(), v1.is_undefined()); stdout.flush(); //import std.stdio; writeln("_used_style_properties_ ", v2.to_string()); stdout.flush(); return(r); }