예제 #1
0
        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);
        }