AD
Administrator
Syncfusion Team
May 19, 2006 04:04 AM UTC
Hi Julie,
We have no other reports of this problem, and have not seen it in our many systems. Attached are screen shots showing Multiselect record on my system which has 4.1 installed.Here is attached screen shot
Multiselect.zip
Exactly what version of Windows XP are you using?
Are you only installing Essential Grid or are you installing Essential Studio? Are you installing binaries only, or the source code version?
What version of the Essential studio are you using?
Have you seen this on multipple systems?
Did you see any errors during the runtime of application?
Thanks for your co-operation.
Regrads
Haneef
JL
Julie Levy
May 19, 2006 05:04 PM UTC
Thanks for your response Haneef. Sorry, the sample i sent you had the listboxSelectionMode set. Selecting rows with the keyboard does work.
What we want is to be able to select using mouse or keyboard individual blocks of cells without selecting the whole row.
I have attached a screenshot, one of the sample i sent you where i can select cells using the mouse, but not the keyboard and the forum sample i got the mousecontroller from which allows me to select those cells using the keyboard.
By the way.. version info is: 4.1.0.62. I installed the Grid from Essential Studio and my OS is XP/SP2.
Thanks,
Julie
Grid_MultiCellSelect.zip
AD
Administrator
Syncfusion Team
May 22, 2006 10:15 AM UTC
Hi Julie,
Try this code to select the multiple cells in a grid. Here is a code snippet.
this.TheGrid.ListBoxSelectionMode = SelectionMode.None;
this.TheGrid.AllowSelection = GridSelectionFlags.Any;
private void TheGrid_CellClick(object sender, GridCellClickEventArgs e)
{
this.TheGrid.Model.Selections.Clear();
}
Here is a modified sample.
http://www.syncfusion.com/Support/user/uploads/Grid_MultiSelect_2a6dec82.zip
Please let me know if this helps.
Best Regards,
Haneef
JL
Julie Levy
May 23, 2006 06:41 PM UTC
Thanks Haneef. This works!
Two questions:
1. The current cell is white even when part of a selection, what''s the best way to make it the same as the selection color?
2. What''s the best way to track when the users moves off of the selection so it can be cleared in that case, in addition to when a cell is clicked. (like Excel).
Thanks again,
Julie
JL
Julie Levy
May 23, 2006 08:38 PM UTC
Nevermind about the Excel-like selection question. I just saw the ExcelLikeCurrentCell option.
AD
Administrator
Syncfusion Team
May 24, 2006 04:18 AM UTC
Hi Julie,
Try this code to change the backcolor of the current cell in a grid. Here is a code snippet.
//Form load event handler
this.TheGrid.PrepareViewStyleInfo += new Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventHandler(this.TheGrid_PrepareViewStyleInfo);
private void TheGrid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
if (e.RowIndex > 0 && e.ColIndex > 0)
{
GridCurrentCell cc = this.TheGrid.CurrentCell;
if (cc.ColIndex == e.ColIndex && cc.RowIndex == cc.RowIndex)
{
e.Style.BackColor = this.TheGrid.AlphaBlendSelectionColor;
}
}
}
Let me know if you need any further assistance.
Thanks for choosing Syncfusion Products.
Best Regards,
Haneef
JL
Julie Levy
May 24, 2006 05:42 PM UTC
Thanks Haneef -
I added this code but now get funny uncleared selection behavior when clicking around the grid. I have included my sample project and a bitmap showing the selection issue.
Julie
Grid_MultiSelect0.zip
JL
Julie Levy
May 24, 2006 09:03 PM UTC
Sorry Haneef, we have decided that it''s okay for the selected cell to be white (like Excel). No need to put the effort in to fix the previous issue i mentioned.
I am, however, having problems with my selected rows being cleared when i right click to pop up a context menu. I think the custom mouse controller is handling when just cells are selected, but when rows are selected using the row header, i need the selections to remain on right click.
Thanks,
Julie
AD
Administrator
Syncfusion Team
May 25, 2006 04:38 AM UTC
Hi Julie,
Issue 1: changing current cell color
Sorry for the inconvenience caused.
Try this code to check the currentcell and change the backcolor of the current cell in a grid. Here is a code snippet.
//PrepareviewStyleInfo event.
if (e.RowIndex > 0 && e.ColIndex > 0)
{
GridCurrentCell cc = this.TheGrid.CurrentCell;
if (cc.ColIndex == e.ColIndex && cc.RowIndex == e.RowIndex )
{
e.Style.BackColor = this.TheGrid.AlphaBlendSelectionColor;
}
}
Issue 2:selection mask
You need to define which buttons can be used for selecting the cells in a grid. Try this code to apply the selection button mask.
this.TheGrid.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;
Here is a modified sample.
http://www.syncfusion.com/Support/user/uploads/Grid_MultiSelect_510ae9b6.zip
Let me know if this helps.
Best Regards,
Haneef
JL
Julie Levy
May 25, 2006 08:47 PM UTC
Thanks Haneef, this works great.
One last question (i promise!). We want to fill in all the available space in the grid window with rows (create empty ones if necessary). I know that setting the background property on the model sets the color below the last row. How do i find out the actual size of the space between the last row in the grid and the bottom of the grid window? What do you think is the best approach to filling rows in the empty space?
Thanks again,
Julie
JL
Julie Levy
May 25, 2006 10:17 PM UTC
Haneef -
so i found the DisplayEmptyRows property which works great. However, i would like to find and interact with these rows to remove the rowheader image and prevent selection. I notice that the rowcount isn''t affected by the empty rows and rowsinserted isn''t fired when they are added.
How do i do this?
Thanks,
Julie
AD
Administrator
Syncfusion Team
May 26, 2006 06:03 AM UTC
Hi Julie,
Thanks for your update.
when you set the DisplayEmptyRows property of the grid, Grid draws the empty row in a clientarea(it is a clientarea only). It doesn''t add any row to the grid. To get the total rowcount(displaycount+gris''s count), You need to handle the prepareviewstyleInfo event. Here is a code snippet.
int totalRowCount = -1;
private void TheGrid_PrepareViewStyleInfo( object sender, GridPrepareViewStyleInfoEventArgs e )
{
if (e.RowIndex > 0 && e.ColIndex > 0)
{
GridCurrentCell cc = this.TheGrid.CurrentCell;
if (cc.ColIndex == e.ColIndex && cc.RowIndex == e.RowIndex)
{
e.Style.BackColor = this.TheGrid.AlphaBlendSelectionColor;
}
if (e.RowIndex > RowCount)
{
totalRowCount = e.RowIndex;
e.Style.Enabled = true;
}
else if( totalRowCount <= this.TheGrid.RowCount)
totalRowCount = this.TheGrid.RowCount;
}
}
To make the DisplayEmptyRows as the orginal row, you need to reassign the rowcount property explictly. Here is a code snippet.
this.TheGrid.RowCount = totalRowCount;
Please let me know if this helps.
Best Regards,
Haneef
JL
Julie Levy
May 26, 2006 05:34 PM UTC
Thanks Haneef, this event is exactly what i needed. I don''t really need the total rows, just a hook to get into the empty rows to change the image on the rowheader. Here''s what i''m doing:
private void TheGrid_PrepareViewStyleInfo( object sender, GridPrepareViewStyleInfoEventArgs e )
{
if (e.RowIndex > this.TheGrid.RowCount)
{
e.Style.Enabled = false;
if (e.ColIndex == 0)
{
//set to empty image
e.Style.ImageIndex = 4;
}
}
}
One last thing. Although the user cannot directly select the empty rows or cells in the empty rows (desired behavior) they can select them if the range starts in a selectable row or cell. I noticed that although the empty rows are excluded from the rowcount, they show up in the selection/range object. Is there a simple way to exclude these rows from the range? or prevent this kind of user selection? Here''s a code snippet of how i''m handling the selection...
private void RemoveRows()
{
GridRangeInfoList oRows = this.TheGrid.Selections.GetSelectedRows( false, true );
foreach (GridRangeInfo range in oRows)
{
GridRangeInfo range1 = range.ExpandRange( 1, 1, this.TheGrid.RowCount, this.TheGrid.ColCount );
//message box to be replaced with call to remove rows
System.Windows.Forms.MessageBox.Show( string.Concat("Remove selected rows ", range1.Top.ToString(), " to ", range1.Bottom.ToString() ));
}
this.TheGrid.Model.Selections.Clear();
}
Thanks for all your help,
Julie
AD
Administrator
Syncfusion Team
May 27, 2006 12:40 PM UTC
Try handing the grid.SelectionChanging event. If e.Range extends over the padded rows, set e.Cancel = true. I think this will prevent the rows from being selected in the first place.
JL
Julie Levy
May 31, 2006 05:08 PM UTC
Thanks, this works great.
Thanks also to Haneef for all your help.