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. Image for the cookie policy date

GridListControl - Win32 API SendMessage Call Problem

HI, In a windows listbox control, if I use Win32 API SendMessage to findstring, it will highlight the found item and also display that item as the first item. I mean, it will apply scrolling to show the item at top. Plz check with below code to observe this behaviour. using System.Runtime.InteropServices; [DllImport("user32.dll", CharSet=CharSet.Auto)] static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, string lParam); IntPtr x = SendMessage(listBox1.Handle, LB_FINDSTRING, -1, textBox1.Text); listBox1.SelectedIndex = x.ToInt32(); However, I am trying to get a custom list box (from GridListControl with one column). But SendMessage seems to be not working as listed above. Any help plz.. Rgds Rajani Kanth

7 Replies

AD Administrator Syncfusion Team January 31, 2006 11:38 AM UTC

Hi Badri, The behavior of SendMessage can be achieved by using the FindItem or FindString method. Here is a sample. Regards, Calvin.

CS7.zip


BR Badri Rajani Kanth February 1, 2006 05:16 PM UTC

Hi Cavin, Try with below code: private void textBox1_TextChanged(object sender, System.EventArgs e) { ListBox1.FindItem(this.textBox1.Text,true,0,true); uint LB_FINDSTRING = 0x018F; IntPtr x = SendMessage(this.listBox2.Handle, LB_FINDSTRING, -1, textBox1.Text); listBox2.SelectedIndex = x.ToInt32(); SendMessage(ListBox1.Handle,WM_VSCROLL ,SB_PAGETOP,0); SendMessage(listBox2.Handle,WM_VSCROLL ,SB_PAGETOP,0); for(int i=0; iHi Badri, > >The behavior of SendMessage can be achieved by using the FindItem or FindString method. Here is a sample. > >Regards, >Calvin.

CS7.zip


BR Badri Rajani Kanth February 1, 2006 05:23 PM UTC

Hi, Plz see the updated sample with problem & solution. May be you can give small issues like this as features/articles so that new comers like me can use directly. Rgds Rajani Kanth

CS70.zip


BR Badri Rajani Kanth April 11, 2006 01:38 PM UTC

Hi, We are using Syncfusion 3.2.1.0 controls. Sometime back you people gave me a sample using GridListControl. When I run and click on gridlist control(right hand side one), the control displays a Big Red X mark. Our client has got this kind of error in DateTimePicker control. To reproduce the same, today we run many syncfusion controls and could see same error in your sample. Plz Go to: http://64.78.18.34/Support/Forums/message.aspx?MessageID=40281 You can find this erraneous sample in reply message given to me by Calvin [Syncfusion] . Rgds Badri Rajani Kanth ============================================== >Hi, > >Plz see the updated sample with problem & solution. May be you can give small issues like this as features/articles so that new comers like me can use directly. > >Rgds >Rajani Kanth

CS70.zip


AD Administrator Syncfusion Team April 12, 2006 10:06 AM UTC

Hi Badri, I regret really for the inconvenience caused. Since the sample that posted in this forum thread was not created in the grid version 3.2 I was not able to see the mentioned issue. But now, when checked the sample in version 3.2 I noticed that the issue is because of calling the Style.ResetBorders() in the DrawCell event handler. So replacing the e.Style.ResetBorders() to e.Style.Borders.All = new GridBorder(GridBorderStyle.None) works fine without any error. Please find the modified code below. But the Style.ResetBorders() works fine in the 3.3 and above versions. The red X suggests that an exception is being thrown during the Paint. You can set the debugger to stop on exception and try to see if the call stack may give some clue. Also refer to this KB article to know more about the red X issue. private void Grid_DrawCell(object sender, GridDrawCellEventArgs e) { GridControl grid = sender as GridControl; if(e.RowIndex != -1 && e.ColIndex != -1) { if(grid.CurrentCell.HasCurrentCellAt(e.RowIndex)) { //e.Style.ResetBorders(); e.Style.Borders.All = new GridBorder(GridBorderStyle.None); if(grid.Focused) { e.Style.BorderMargins.Top = 1; if(e.ColIndex == this.ListBox1.ImageColumn) e.Style.BorderMargins.Left = 2; } } } } Regards, Calvin.


BR Badri Rajani Kanth April 12, 2006 02:40 PM UTC

Thank You Cavin, As I explained earlier, we are getting this error in DateTimePickerAdv control also. But there we are NOT handling any of the paint routines. We guess similer is the case with that control also. There can be some deprecated methods. Can you plz list me some methods of DateTimePickerAdv which can cause this error. As we are getting this error on client machine, we could not get much debugging info. Rgds Rajani Kanth


LR Liam Reilly October 11, 2006 12:27 PM UTC

Any word on a solution to this issue as we are having a similar problem with the Red X

Loader.
Live Chat Icon For mobile
Up arrow icon