How can I find which row in the root corresponds to the current child view

Posted by: patrik on 12 October 2024, 9:44 am EST

  • Posted 12 October 2024, 9:44 am EST

    I’m using the following code to open a child view based on the user’s click:

    sv = GetSpreadView(FpSpread3.GetRootWorkbook().GetActiveWorkbook(), e.X, e.Y);[
    public FarPoint.Win.Spread.SpreadView GetSpreadView(FarPoint.Win.Spread.SpreadView sv, int x, int y)
    {
        try
        {
            Rectangle r = sv.Bounds;
            FarPoint.Win.Spread.SpreadView ret = null;
            if (!r.Contains(x, y))
            {
                return null;
            }
            ArrayList al = sv.GetRootWorkbook().GetChildWorkbooks();
            foreach (FarPoint.Win.Spread.SpreadView c in al)
            {
                if (ret != null)
                {
                    return ret;
                }
            }
            return sv;
        }
        catch (System.Exception Ex)
        {
            throw Ex;
        }
    }
    

    This works well to get the correct child view, but now I would like to know which row in the root workbook corresponds to this child view. Is there any way to determine which row in the root is linked to the currently opened child view?

    I use MouseDown event

    Thanks in advance for your help!

  • Posted 15 October 2024, 6:39 am EST

    Hi Patrik,

    Thanks for the code snippet.

    We have created a sample application that contains hierarchical data. Refer HierarchyScroll.zip.

    We kindly request you update the FpSpread’s MouseDown event as per your implementation. This will help us understand your use-case exactly so that we can provide you with a more specific solution.

    Thanks & Regards,

    Aastha

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels