Getting rid of active cell on almost read only form

Posted by: aslyon on 8 September 2017, 1:15 pm EST

  • Posted 8 September 2017, 1:15 pm EST

    I have a table that is locked/protected apart from a column containing a check box. The functionality I want is the whole row to be highlighted when the user clicks anywhere on that row, including the checkbox. I have tried to set the style of the table to select whole row, but where the user clicks always ends up with the activeCell contrast colour. Also, when the table is displayed initially, the top row is selected (although no activeCell is highlighted) which I don't want.

    I set the sheet with these parameters

    <FONT size=2>

    <FONT color=#000080>mySheet.OperationMode = FarPoint.Win.Spread.OperationMode.RowMode </FONT>

    </FONT><FONT size=2><FONT color=#000080>mySheet.SelectionBackColor = <FONT size=2>Color.AliceBlue</FONT></FONT></FONT>

    <FONT size=2><FONT color=#000080>mySheet.SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors</FONT>

    <FONT color=#000080>mySheet.SelectionPolicy = FarPoint.Win.Spread.Model.SelectionPolicy.Single</FONT>

    <FONT color=#000080>mySheet.SelectionUnit = FarPoint.Win.Spread.Model.SelectionUnit.Row</FONT>

    <FONT size=3>if I set</FONT> <FONT color=#000080>mySheet.OperationMode = FarPoint.Win.Spread.OperationMode.<FONT>SingleSelect</FONT></FONT><FONT> </FONT><FONT size=3>I</FONT><FONT size=2> get the look that I want but then I loose the ability to check/uncheck the checkbox on each row. </FONT>

    How can I get rid of the highlight of activeCell and how can I avoid the top row being selected with my selectionBackColor when I open the form???

    Thanks for any help!

  • Replied 8 September 2017, 1:15 pm EST


    There has to be an active cell when starting the application with a Spread control and this is why you are seeing the first row as selected. You can move the active cell to a row off the visible Spread, or hide a row and make it active if you do not want to see a row selected initially. If you like to paint the active cell differently, you would need to create an implementation of an IFocusIndicatorRenderer to attach to the Spread.

    	<SPAN class=kwd>Private Sub</SPAN> Form1_Load(<SPAN class=kwd>ByVal</SPAN> sender <SPAN class=kwd>As</SPAN> System.<SPAN class=kwd>Object</SPAN>, <SPAN class=kwd>ByVal</SPAN> e <SPAN class=kwd>As</SPAN> System.EventArgs) <SPAN class=kwd>Handles MyBase</SPAN>.Load
    FpSpread1.Sheets(0).OperationMode = FarPoint.Win.Spread.OperationMode.RowMode
    FpSpread1.FocusRenderer = <SPAN class=kwd>New</SPAN> myrenderer
    FpSpread1.Sheets(0).SelectionBackColor = Color.AliceBlue
    FpSpread1.Sheets(0).SelectionStyle = FarPoint.Win.Spread.SelectionStyles.SelectionColors
    <SPAN class=kwd>End Sub

    Public Class</SPAN> myrenderer
    <SPAN class=kwd>Implements</SPAN> FarPoint.Win.Spread.IFocusIndicatorRenderer

    <SPAN class=kwd>Public Sub</SPAN> Paint(<SPAN class=kwd>ByVal</SPAN> g <SPAN class=kwd>As</SPAN> Graphics, <SPAN class=kwd>ByVal</SPAN> X <SPAN class=kwd>As Integer</SPAN>, <SPAN class=kwd>ByVal</SPAN> y <SPAN class=kwd>As Integer</SPAN>, <SPAN class=kwd>ByVal</SPAN> width <SPAN class=kwd>As Integer</SPAN>, <SPAN class=kwd>ByVal</SPAN> height <SPAN class=kwd>As Integer</SPAN>, <SPAN class=kwd>ByVal</SPAN> left <SPAN class=kwd>As Boolean</SPAN>, <SPAN class=kwd>ByVal</SPAN> top <SPAN class=kwd>As Boolean</SPAN>, <SPAN class=kwd>ByVal</SPAN> right <SPAN class=kwd>As Boolean</SPAN>, <SPAN class=kwd>ByVal</SPAN> bottom <SPAN class=kwd>As Boolean</SPAN>) <SPAN class=kwd>Implements</SPAN> FarPoint.Win.Spread.IFocusIndicatorRenderer.Paint
    g.FillRectangle(<SPAN class=kwd>New</SPAN> SolidBrush(Color.AliceBlue), <SPAN class=kwd>New</SPAN> RectangleF(X, y, width - 1, height - 1))

    <SPAN class=kwd>End Sub
    End Class</SPAN>
Need extra support?

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

Learn More

Forum Channels