We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

WorkBook

Looking at GridPad Example.. based on that i created a new sample app using WorkbookModel workBook = new WorkbookModel("WorkBook"); workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 1",gridDataBoundGrid1.Model)); workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 2",gridDataBoundGrid2.Model)); WorkbookForm doc = new WorkbookForm(workBook ); doc.Show(); I can see both the grid displayed inside worksheet... but doesn''t allow free-flow cell-by-cell or row navigation.. the same applies to Gridpad example.. if a new grid is opened inside workbook frame.. it doesn''t allow free-flow navigation in the grid nested inside the worksheet.. Furthermore is there any event available that is raised as soon as user clicks on different worksheet... And finally is it possible to add a sheet once the worksheet form is loaded because i tried using Add or Insert method it raised an Specified Argument out of range exception workBook.Worksheets.Insert(0,new WorksheetModel(workBook,"Sheet 3",gridDataBoundGrid2.Model)); or workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 3",gridDataBoundGrid2.Model)); Regards Yogi

2 Replies

AD Administrator Syncfusion Team February 11, 2005 12:45 AM UTC

Hi Yogi, not sure what "free-flow navigation" means. Can you explain? When the user clicks on a tab in the tabbeam a TabBarSplitterControl.ActivePageChanging event is raised. While looking at your questions I noticed one bug in the sample and one bug in our library code. The first problem was that the grids inside the worksheets were having no mouse controllers. The result is that clicking cells does not work. To make the grids within the sheets accept mouse clicks do the following: Add a class GridModelEx public class GridModelEx : GridModel, ICreateControl { Control ICreateControl.CreateControl() { GridControlBase grid = new SampleGrid(this); grid.FillSplitterPane = true; return grid; } } and change the MenuAction: public class NewWorkbookFile : BasicAction { int windowCount = 0; WorkbookModel workbook; public override void InvokeAction(object sender, EventArgs e) { windowCount++; workbook = new WorkbookModel("Workbook"); GridModel sheet1 = new GridModelEx(); SampleGrid.SetupGridModel(sheet1); GridModel sheet2 = new GridModelEx(); SampleGrid.SetupGridModel(sheet2); workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 1", sheet1)); workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 2", sheet2)); WorkbookForm doc = new WorkbookForm(workbook); doc.ThemesEnabled = true; doc.Text = workbook.Name + windowCount.ToString(); doc.MdiParent = MainWindow; doc.Show(); } } The other problem is that there is a bug with adding worksheets. We''ll need to fix that. But, I was able to work around the issue with the following code and got it working: public class SampleGrid : GridControl { protected override void OnCellDoubleClick(GridCellClickEventArgs e) { WorkbookForm form = FindForm() as WorkbookForm; if (form != null) { WorkbookModel workbook = form.WorkbookView.Workbook; GridModel sheet3 = new GridModelEx(); SampleGrid.SetupGridModel(sheet3); WorksheetModel workSheetModel = new WorksheetModel(workbook, "Sheet 3", sheet3); form.WorkbookView.TabBarPages.Add(new WorksheetView(workSheetModel, form.WorkbookView)); workbook.Worksheets.BeginUpdate(); workbook.Worksheets.Add(workSheetModel); workbook.Worksheets.EndUpdate(); } base.OnCellDoubleClick (e); } Stefan >Looking at GridPad Example.. based on that i created a new sample app using > >WorkbookModel workBook = new WorkbookModel("WorkBook"); >workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 1",gridDataBoundGrid1.Model)); >workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 2",gridDataBoundGrid2.Model)); >WorkbookForm doc = new WorkbookForm(workBook ); >doc.Show(); > >I can see both the grid displayed inside worksheet... but doesn''t allow free-flow cell-by-cell or row navigation.. the same applies to Gridpad example.. if a new grid is opened inside workbook frame.. it doesn''t allow free-flow navigation in the grid nested inside the worksheet.. > >Furthermore is there any event available that is raised as soon as user clicks on different worksheet... > >And finally is it possible to add a sheet once the worksheet form is loaded because i tried using Add or Insert method it raised an Specified Argument out of range exception > >workBook.Worksheets.Insert(0,new WorksheetModel(workBook,"Sheet 3",gridDataBoundGrid2.Model)); >or >workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 3",gridDataBoundGrid2.Model)); > >Regards >Yogi


AD Administrator Syncfusion Team February 11, 2005 04:20 PM UTC

Thx Stefan.. your support rocks...this is what i was looking for .. >Hi Yogi, > >not sure what "free-flow navigation" means. Can you explain? > >When the user clicks on a tab in the tabbeam a TabBarSplitterControl.ActivePageChanging event is raised. > >While looking at your questions I noticed one bug in the sample and one bug in our library code. > >The first problem was that the grids inside the worksheets were having no mouse controllers. The result is that clicking cells does not work. > >To make the grids within the sheets accept mouse clicks do the following: > >Add a class GridModelEx > > > public class GridModelEx : GridModel, ICreateControl > { > Control ICreateControl.CreateControl() > { > GridControlBase grid = new SampleGrid(this); > grid.FillSplitterPane = true; > return grid; > } > } > > >and change the MenuAction: > > > public class NewWorkbookFile : BasicAction > { > int windowCount = 0; > WorkbookModel workbook; > public override void InvokeAction(object sender, EventArgs e) > { > windowCount++; > workbook = new WorkbookModel("Workbook"); > GridModel sheet1 = new GridModelEx(); > SampleGrid.SetupGridModel(sheet1); > GridModel sheet2 = new GridModelEx(); > SampleGrid.SetupGridModel(sheet2); > > workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 1", sheet1)); > workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 2", sheet2)); > > WorkbookForm doc = new WorkbookForm(workbook); > doc.ThemesEnabled = true; > doc.Text = workbook.Name + windowCount.ToString(); > doc.MdiParent = MainWindow; > doc.Show(); > } > > } > > >The other problem is that there is a bug with adding worksheets. We''ll need to fix that. > >But, I was able to work around the issue with the following code and got it working: > > > public class SampleGrid : GridControl > { > protected override void OnCellDoubleClick(GridCellClickEventArgs e) > { > WorkbookForm form = FindForm() as WorkbookForm; > if (form != null) > { > WorkbookModel workbook = form.WorkbookView.Workbook; > > GridModel sheet3 = new GridModelEx(); > SampleGrid.SetupGridModel(sheet3); > > WorksheetModel workSheetModel = new WorksheetModel(workbook, "Sheet 3", sheet3); > form.WorkbookView.TabBarPages.Add(new WorksheetView(workSheetModel, form.WorkbookView)); > workbook.Worksheets.BeginUpdate(); > workbook.Worksheets.Add(workSheetModel); > workbook.Worksheets.EndUpdate(); > } > > base.OnCellDoubleClick (e); > } > > >Stefan > >>Looking at GridPad Example.. based on that i created a new sample app using >> >>WorkbookModel workBook = new WorkbookModel("WorkBook"); >>workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 1",gridDataBoundGrid1.Model)); >>workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 2",gridDataBoundGrid2.Model)); >>WorkbookForm doc = new WorkbookForm(workBook ); >>doc.Show(); >> >>I can see both the grid displayed inside worksheet... but doesn''t allow free-flow cell-by-cell or row navigation.. the same applies to Gridpad example.. if a new grid is opened inside workbook frame.. it doesn''t allow free-flow navigation in the grid nested inside the worksheet.. >> >>Furthermore is there any event available that is raised as soon as user clicks on different worksheet... >> >>And finally is it possible to add a sheet once the worksheet form is loaded because i tried using Add or Insert method it raised an Specified Argument out of range exception >> >>workBook.Worksheets.Insert(0,new WorksheetModel(workBook,"Sheet 3",gridDataBoundGrid2.Model)); >>or >>workBook.Worksheets.Add(new WorksheetModel(workBook,"Sheet 3",gridDataBoundGrid2.Model)); >> >>Regards >>Yogi

Loader.
Live Chat Icon For mobile
Up arrow icon