FlexGrid for WinForms

Checkbox Col with some cells in style noCheckBox

  •  breitbach said 10 months, 2 weeks ago:

    Hello,

    I have an unbound flex gridclassic, which displays articles and the sum of the articels.

    For the arcticles i will show a checkbox in col 11.

    I formated col 11 with
    fg.ColumnCollection (11) did. DataType = GetType (Boolean),
    so that I can filter the column for all rows with true or false. The lines with the totals has the value null.

    In the lines with the totals I want to display an checkbox with the style of "NoCheckbox".

    I tried the followings :

    fg.Cell(flexcpChecked, 4, 11) = CellCheckedSettings.flexNoCheckbox
    fg.SetCellCheck(4, 11, C1FlexGrid.CheckEnum.None)
    fg.cell(flexcppicture, 4, 11)= imgEmpty.image
    fg.Cell(flexcpPicture, 4, 11) = Nothing

    but nothing helps.

    Has anyone an idea how to realize "NoCheckbox" in this cell.

    My C1.Win.C1Flexgrid.classic.2 Version is V 2.6.2012.682

    Thanks for any help.

    With kindly regards

    Juergen

  •  Wolfgang Knauf7p said 10 months, 2 weeks ago:

    Hi,

    this line should do the job:

    fg.SetCellCheck(4, 11, C1FlexGrid.CheckEnum.None)

    So, there must be some other problem. How do you create the sum row? Do you use the C1FlexGrid functions "Aggregate" or "Subtotal"?

    Best regards

    Wolfgang

  •  breitbach said 10 months, 1 week ago:

    Hello Wolfgang,

    thanks for your response.

    The totals in the grid are calculated manually and the grid has no node or subtotals.

    I have made an little example (See attachment or code below).

    In this example there is a col defined as boolean. You can set the cell.check to checked or to unchecked. The "C1FlexGrid.CheckEnum.None" doesnot works.

    Best regards

    Juergen

    Example :

    Imports C1.Win.C1FlexGrid.Classic
    Imports C1.Win.C1FlexGrid.Classic.CellPropertySettings

    Public Class Form1

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    show_fg(True)

    End Sub

    Private Sub show_fg(ByVal B_col As Boolean)
    Try

    With fg
    .GridLines = C1.Win.C1FlexGrid.Classic.GridStyleSettings.flexGridNone
    .Rows = 8
    .Cols = 4
    If B_col = True Then
    .ColumnCollection(2).DataType = GetType(Boolean)
    Else
    .ColumnCollection(2).DataType = GetType(Integer)
    End If
    .BackColorBkg = Color.White

    End With
    Dim r As Integer
    Dim c As Integer

    For r = 1 To 7
    fg.Cell(flexcpText, r, 1) = "row " & r
    Next

    fg.Cell(flexcpChecked, 1, 2) = C1.Win.C1FlexGrid.CheckEnum.Checked
    fg.Cell(flexcpText, 1, 3) = "fg.Cell(flexcpChecked, 1, 2) = C1.Win.C1FlexGrid.CheckEnum.Checked"

    fg.Cell(flexcpChecked, 2, 2) = C1.Win.C1FlexGrid.CheckEnum.Unchecked
    fg.Cell(flexcpText, 2, 3) = "fg.Cell(flexcpChecked, 2, 2) = C1.Win.C1FlexGrid.CheckEnum.Unchecked "

    fg.Cell(flexcpChecked, 3, 2) = C1.Win.C1FlexGrid.CheckEnum.None
    fg.Cell(flexcpText, 3, 3) = "fg.Cell(flexcpChecked, 3, 2) = C1.Win.C1FlexGrid.CheckEnum.None"

    fg.Cell(flexcpPicture, 4, 2) = imgBild.Image
    fg.Cell(flexcpText, 4, 3) = "fg.Cell(flexcpPicture, 4, 2) = imgBild.Image" : fg.Cell(flexcpPicture, 4, 3) = imgBild.Image

    fg.SetCellCheck(5, 2, C1.Win.C1FlexGrid.CheckEnum.Checked)
    fg.Cell(flexcpText, 5, 3) = "fg.SetCellCheck(7, 2, C1.Win.C1FlexGrid.CheckEnum.Checked)"

    fg.SetCellCheck(6, 2, C1.Win.C1FlexGrid.CheckEnum.Unchecked)
    fg.Cell(flexcpText, 6, 3) = "fg.SetCellCheck(7, 2, C1.Win.C1FlexGrid.CheckEnum.Unchecked)"

    fg.SetCellCheck(7, 2, C1.Win.C1FlexGrid.CheckEnum.None)
    fg.Cell(flexcpText, 7, 3) = "fg.SetCellCheck(5, 2, C1.Win.C1FlexGrid.CheckEnum.None)"

    fg.AutoSizeCol(3)

    Catch ex As Exception
    MsgBox(ErrorToString)
    End Try
    End Sub

    Private Sub cmd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmd.Click

    If fg.ColumnCollection(2).DataType.Name = "Boolean" Then
    show_fg(False)
    Else
    show_fg(True)
    End If

    End Sub
    End Class

    Attachments:
    You must be logged in to view attched files.
  •  Mohita24p said 10 months, 1 week ago:

    Hello,

    I could replicate the behavior that setting 'C1FlexGrid.CheckEnum’ to None has no effect as per expected. It seems like a bug to me and hence, I am escalating the issue to the concerned team.

    However,a workaround for you is to apply a new style on the particuolar cell. You may use the following code :
    C1FlexGrid1.Cols(2).DataType = GetType(Boolean)
    Dim s As CellStyle = C1FlexGrid1.Styles.Add("NewStyle")
    s.DataType = GetType(String)
    C1FlexGrid1.SetCellStyle(4, 2, s)

    This should solve your problem.

    Regards,
    Mohita

  •  breitbach said 10 months, 1 week ago:

    Hello Mohita,

    thanks a lot for your help. The workaround solves the problem.

    Do you think that it can be fixed in next two weeks or shall I use your workaround ?

    Best regards
    Juergen

  •  C1_BernardoC7p said 10 months, 1 week ago:

    Hello thread.

    This is the design behavior. Settings Checked, Unchecked, and None can be applied to any cells in unbound mode, or to cells that do not have a data type associated with them.

    When you specify that the column contains boolean values, then each cell must contain either TRUE or FALSE (Checked and Unchecked). In this context, None is not a valid state for the cell.

    The code above addresses this correctly: it overrides the cell style to specify a data type that is not boolean.

  •  breitbach said 10 months, 1 week ago:

    Hello Bernado,

    thank you for your explanation. I understand that cells in cols with the format boolean, only can be true or false.

    If the col has not an boolean format, then it is no problem to set the cells to the values checke, unchecked or no Checkbox. But then the filter of the grid does not work and the checkbox value is not exported, if you save the grid to excel.

    In my application I have 20 grids with checkboxes. On 12 Grids I can make the column boolean with no problem. But there are also 8 grids where the cell may be true, false or nothing.

    Please tell me, if you think that you will change it or not. If not, I will make the workaround from Mohita.

    Thanks a lot for your answer.

    Best regards
    Juergen

  •  C1_BernardoC7p said 10 months, 1 week ago:

    Hello Juergen

    I am surprised that the Excel export wouldn’t work. If the cell contains a boolean value, it should be exported regardless of the column type. This seems to work fine for me. Do you have a sample showing that problem?

    Did you consider the option of using OwnerDraw cells? I think that would allow you to suppress the checkboxes in selected cells. Something like

    private void OwnerDrawCell(…)
    {
        if (SuppressCheckBox(e.Row, e.Column))
        {
          e.DrawCell(Background);
          e.Handled = true;
        }
    }
  •  breitbach said 10 months, 1 week ago:

    Hello Bernado,

    I attached an example with the export to Excel. Please try to export and to filter.

    Some times ago you have explained to me, that the coldatatype must be boolean for filtering.

    I used ownerdraw to set lines in some grid. But I don’t prefer ownerdraw, because then I have a problem with the forecolor of selected cells.

    If you select a range of 1,1 to 5,2 and one of this cells has an forecolor blue and one of the cell has red and the other cells are black, then on an grid

    with ownerdraw : All selected cells has the same (only one) forecolor

    withoutowner draw : All selected cell has the correct forecolor black, red and blue

    Thanks a lot for your answer.

    Best regards
    Juergen

    Attachments:
    You must be logged in to view attched files.
  •  C1_BernardoC7p said 10 months, 1 week ago:

    Hello Juergen

    I made a small change in the latest build (version 702) that addresses both issues. The value returned by the GetCellChecked method is now taken into account when exporting and filtering data.

    This latest is currently being tested by our QA team and should be available for download soon.

    If you want me to send you a preview copy so you can help test it, just let me know.

    Thanks for helping us improve our products.

    Answer
  •  breitbach said 10 months, 1 week ago:

    Hello Bernardo,

    thanks a lot for your help.

    Please tell me when the update is available. Then I will download the update and test it.

    Best regards
    Juergen

  •  C1_BernardoC7p said 10 months, 1 week ago:

    You can download a preview copy now, here’s the URL:

    ftp://publicfiles.componentone.com/Bernardo/FlexGrid_703.zip

    This is a debug build, to be used for testing only.

    Thanks.

  •  breitbach said 10 months, 1 week ago:

    Hello Bernado,

    thanks for the realy quick changes and your help. That is very good.

    I have download the update. I’m just exporting all grids to excel and format them in Excel.

    I will give you no later than next Monday a feedback.

    Best regards Juergen

  •  breitbach said 10 months, 1 week ago:

    Hello Bernardo,

    I have download the flexgrid.dlls.

    C1.Flexgrid has the version 703, but the flexgrid.classic has the version 0. Please see the attachment. One more information for you. The companynames of the two grids are different (GrapeCity and Componente One).

    For the installation. Please can you give me a short installation guide.

    Thanks Juergen

    Attachments:
    You must be logged in to view attched files.
  •  domsinclair5p said 10 months, 1 week ago:

    Hi Juergen

    In the zip file to which Bernardo posted the link there are two files (flexgrid, and FlexGrid Classic). You are probably only interested in the flexgrid for testing purposes at present so I would suggest that you do the following:

    In "C:Program Files (x86)ComponentOneStudio for WinFormsbinv2″ (or if you’re running a 32 bit operating system it will be just C:Program Files etc) locate the existing C1.Win.C1FlexGrid.2.dll and rename it (I usually just append the worl '.old’ to it) so that you can easily restore it once you’ve finished testing.

    Now open the zip file and extract the 703 version of the flexgrid dll to the location where you just renamed the old one.

    Once extracted it’s possible that the new file will be blocked by the operating system so open up windows explorer , navigate to the folder where it is and then selct it. Right click and slect properties. If you see a button at the bottom of the first tab in the properties dialog saying 'Unblock’ then click it.

    Now simply test the dll in your project (ensuring that within visual studio the 'SpecificVersion’ property of the flexgrid dll is set to false.

    HTH

    Dom

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.