GregBiernacki
2017-06-29T21:14:12Z
Hello,

I'm trying to capture the windows messages coming into the textbox of the iGrid control, primarily the WM_PASTE message but I'm finding that the below code is not working. When I put my breakpoint into the else section of my code it never hits there even after I've pasted into the textbox of a cell.

I first created my own grid control class and inherited from iGrid. I then added an override for WndProc as shown below, but the WM_PASTE message is never captured. I verified other messages are captured for the iGrid by putting my breakpoint at the IF statement and i'm finding it is capturing messages the minute I scroll over the grid control, just doesn't seem to be capturing the messages that are going into the textbox. My guess it is a separate control? Is there a way to capture the messages going into the textbox control of the iGrid control?



    Private Const WM_PASTE As Integer = &H302

    Protected Overrides Sub WndProc(ByRef m As Message)

        If m.Msg <> WM_PASTE Then

            'Handle all other messages normally
            MyBase.WndProc(m)
        Else
            Dim pasteText As String = ""
            Dim appendBeforePasteString As String = ""
        End If

    End Sub            


Thanks,
Greg
Igor/10Tec
2017-06-30T11:52:41Z
Yes, you are right - iGrid uses the standard .NET TextBox control to edit its cells. It's a separate control created on-the-fly in iGrid.

Knowing the iGrid infrastructure, I do not think it's a good idea to obtain this textbox's hwnd and overwrite its WndProc. Can you tell us, what functionality do you want to implement this way?
GregBiernacki
2017-06-30T13:33:25Z
I filter out a user's keystrokes based on the custom datatype I have implemented into the iGrid. I've also created my own custom drop down as the current drop down available did not support the functionality I was looking for. In either case, I would now like to open up the option for users to be be able to paste in the cells but would like to filter out invalid values during the paste.
Igor/10Tec
2017-07-01T11:11:47Z
Understood. If it helps somehow you or other developers, we ave a set of built-in tools to customize editing:

1) Events like TextBoxFilterChar to filter characters entered by the user.

2) The IiGDropDownControl interface the developer can use to implement custom drop-down editors for iGrid cells (not only drop-down lists).

3) The abstract iGCellEditorBase class one can use to implement a fully customizable cell editor.

Looking at the description of your task, you could try to implement your custom editor and attach it to iGrid using approach #3.
GregBiernacki
2017-07-03T13:39:08Z
Thank you! Sounds like number 3 should work for me, I'll give it a try.