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.
Unfortunately, activation email could not send to your email. Please try again.

GDBG Cell Icon problem

Thread ID:

Created:

Updated:

Platform:

Replies:

20481 Oct 19,2004 01:41 PM Oct 20,2004 12:20 PM Windows Forms 7
loading
Tags: GridControl
Gordon Rhea
Asked On October 19, 2004 01:41 PM

Hi, I''ve got a databound grid that has an icon set for a combobox cell on validation to indicate an error (the CellTipText is also set). Once the error Icon is set the icon shows up in the cell until the mouse is moved over the cell then the icon is reset to the non-error icon. I am turning on and off the icon in PrepareViewStyleInfo based on the value of the error message (no error message = normal icon, error message = error icon). The error message isn''t being reset and the code to display the icon in PrepareViewStyleInfo isn''t being called when the icon is reset to the default non-error icon (the CellTipText is still defined). I''m using a GridBoundColumn to set up the columns of the table in the grid. I suspect that I''m not setting up the column correctly somewhere but I don''t know what to set. Any help would be appreciated. Thanks, Gordon

Administrator [Syncfusion]
Replied On October 19, 2004 01:57 PM

I cannot follow what you are describing. Is ''error message'' your object, or is it grid.CurrentCell.ErrorMessage? Who should be resetting it? Maybe if you posted your PrepareViewStyleInfo code and any other snippets, it would make it clearer what you are trying to do.

Gordon Rhea
Replied On October 19, 2004 02:07 PM

Private Sub gdbgVerifyIO_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles gdbgVerifyIO.PrepareViewStyleInfo If e.ColIndex = Me.gdbgVerifyIO.Model.NameToColIndex(Me.VERIFYIO_DEF) _ AndAlso Me.gdbgVerifyIO.Model(e.RowIndex, Me.gdbgVerifyIO.Model.NameToColIndex(Me.VERIFYIO_TYPE)).Text.Equals("Input") _ AndAlso Not Me.mblnInUpdate Then mblnInUpdate = True If Not mstrErrorText Is Nothing AndAlso mstrErrorText.Length > 0 Then e.Style.ImageIndex = 1 mstrOldErrorText = mstrErrorText e.Style.CellTipText = mstrErrorText Else e.Style.ImageIndex = 0 mstrOldErrorText = mstrErrorText e.Style.CellTipText = mstrErrorText End If Me.gdbgVerifyIO.Refresh() mblnInUpdate = False End If End Sub ...From the load routine... Dim gbc2 As New GridBoundColumn gbc2.MappingName = Me.VERIFYIO_DEF gbc2.StyleInfo.CellType = "ComboBox" gbc2.StyleInfo.ChoiceList = Me.mstrcolVerify gbc2.StyleInfo.ImageList = Me.ilErrorIcons gbc2.StyleInfo.ImageIndex = 0 Me.gdbgVerifyIO.GridBoundColumns.Add(gbc2) ... From the validation code... If Me.gdbgVerifyIO.Model(intInputRow, Me.gdbgVerifyIO.Model.NameToColIndex(Me.VERIFYIO_DEF)).CellValue Is Nothing _ OrElse Me.gdbgVerifyIO.Model(intInputRow, Me.gdbgVerifyIO.Model.NameToColIndex(Me.VERIFYIO_DEF)).CellValue Is System.DBNull.Value _ OrElse Me.gdbgVerifyIO.Model(intInputRow, Me.gdbgVerifyIO.Model.NameToColIndex(Me.VERIFYIO_DEF)).Text.Length <= 0 Then '' we have an error ''mstrOldErrorText = mstrErrorText mstrErrorText = "Input not specified!" e.Cancel = True Else ''mstrOldErrorText = mstrErrorText mstrErrorText = "" End If

Administrator [Syncfusion]
Replied On October 19, 2004 04:22 PM

So when you click off the cell that has a wrong value, you want to show an icon until you move the mouse over the cell, and then you want to see an error tip displayed. Is this correct? Here is a sample that does this. It does this by dynamically subscribing to the cell controls mouseenter and mouseleave events to display a WindowsForms tooltip. WindowsApplication8_7519.zip

Gordon Rhea
Replied On October 20, 2004 08:36 AM

No. I want the error icon to be displayed in the cell until the value is changed. What is happening now is that the error icon is going away as soon as the user moves the mouse over the cell with the error. I can reset the error message when the cell is changed so that''s not a problem. The problem is that I can''t get the error icon to stay until the cell is changed.

Gordon Rhea
Replied On October 20, 2004 09:07 AM

Let me start over and describe the process that''s suposed to happen. What''s suposed to happen: When the grid loads it loads all the data except one cell where the user can select from a list of possible values. When the user saves the grid it is validated, if there are errors it will not save. It should replace the icon telling the user to enter data with an error icon. The error icon should remain in the cell until the value is changed at which time the icon should be reset the the default icon. What is actually happening: The error icon is being set in validation, but once the user moves the mouse over the cell the icon is being changed back to the default icon even though there is still an error message. I have put a break in the PrepareViewStyleInfo event where I reset the icon to the default (the only place I change the icon is in the PrepareViewStyleInfo event) and it is not executing, but the icon is still being reset. The CellTipText value is not being reset, only the icon. Hopefully this will help clarify what''s going on. Gordon

Administrator [Syncfusion]
Replied On October 20, 2004 10:52 AM

I think this is somewhat simpler to handle. You do not have to dynamically subscribe to the cell control mouse events to catch these actions. Here is another little sample. It will mark any non-number in the first column when you click the Validate button. The cell stays marked until you change it. WindowsApplication9_7453.zip

Gordon Rhea
Replied On October 20, 2004 12:20 PM

That took care of it. I just had to set the style right (i was trying to do it using a GridBoundColumn) Thanks Clay, Gordon

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;