Bryan Brannon
Top achievements
Rank 2
Bryan Brannon
asked on 24 Jan 2008, 09:41 PM
Is it possible to use the RadRepeat button to scroll a RadPanel or any controls that have the standard scrolling functionality: Grid, ListBox.
I have a touchscreen application and need the scroll bar buttons to be oversized.
I have a touchscreen application and need the scroll bar buttons to be oversized.
8 Answers, 1 is accepted
0
Hi Bryan Brannon,
Yes, it is possible. Most of the controls can be scrolled by using the Win32 API SendMessage() to send WM_VSCROLL or WM_HSCROLL messages to the control's handle.
However, for our controls that have RadScrollBars it is possible to scroll in a better way.
You can find the examples below for vertical scrolling.
Handler for ScrollDown:
Handler for ScrollDown:
The horizontal ScrollBar of RadGridView can be obtained with the following code:
I hope this helps. Please contact me again, if you need further assistance.
Regards,
Angel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Yes, it is possible. Most of the controls can be scrolled by using the Win32 API SendMessage() to send WM_VSCROLL or WM_HSCROLL messages to the control's handle.
However, for our controls that have RadScrollBars it is possible to scroll in a better way.
You can find the examples below for vertical scrolling.
For RadListBox:
Handler for ScrollUp:Point newValue = this.radListBox1.ListBoxElement.Value; |
newValue.Y -= this.radListBox1.ListBoxElement.VerticalScrollBar.SmallChange; |
if (newValue.Y < this.radListBox1.ListBoxElement.MinValue.Y) |
newValue.Y = this.radListBox1.ListBoxElement.MinValue.Y; |
this.radListBox1.ListBoxElement.Value = newValue; |
Handler for ScrollDown:
Point newValue = this.radListBox1.ListBoxElement.Value; |
newValue.Y += this.radListBox1.ListBoxElement.VerticalScrollBar.SmallChange; |
int maxVisualValue = this.radListBox1.ListBoxElement.MaxValue.Y - |
this.radListBox1.ListBoxElement.VerticalScrollBar.LargeChange + 1; |
if (newValue.Y > maxVisualValue) |
newValue.Y = maxVisualValue; |
this.radListBox1.ListBoxElement.Value = newValue; |
The horizontal scrolling can be achieved by using X instead of Y members of the values.
For RadGridView:
Handler for ScrollUp:RadScrollBarElement verticalScrollBar = (RadScrollBarElement)((GridTableElement)this.radGridView1.GridElement).Children[3]; |
int newValue = verticalScrollBar.Value - verticalScrollBar.SmallChange; |
if (newValue >= verticalScrollBar.Minimum) |
verticalScrollBar.Value = newValue; |
else |
verticalScrollBarverticalScrollBar.Value = verticalScrollBar.Minimum; |
Handler for ScrollDown:
RadScrollBarElement verticalScrollBar = (RadScrollBarElement)((GridTableElement)this.radGridView1.GridElement).Children[3]; |
int newValue = verticalScrollBar.Value + verticalScrollBar.SmallChange; |
int maxVisualValue = verticalScrollBar.Maximum - verticalScrollBar.LargeChange + 1; |
if (newValue <= maxVisualValue) |
verticalScrollBar.Value = newValue; |
else |
verticalScrollBar.Value = maxVisualValue; |
The horizontal ScrollBar of RadGridView can be obtained with the following code:
RadScrollBarElement horizontalScrollBar = (RadScrollBarElement)((GridTableElement)this.radGridView1.GridElement).Children[4]; |
I hope this helps. Please contact me again, if you need further assistance.
Regards,
Angel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Bryan Brannon
Top achievements
Rank 2
answered on 25 Jan 2008, 02:44 PM
Thank you for the quick response.
I assume that the RadListBox and RadGridView are the only two that will allow for the "better way" of scrolling. If for instance I wanted to scroll a RadPanel... I would need to use the Win32 API using the SendMessage().
I assume that the RadListBox and RadGridView are the only two that will allow for the "better way" of scrolling. If for instance I wanted to scroll a RadPanel... I would need to use the Win32 API using the SendMessage().
0
Accepted
Hi Bryan,
Yes, you will have to use SendMessage(). I tried to use VerticalScroll.Value for RadPanel (and for Microsoft's Panel) but the scrollbar and the content of the panel were not synchronized well.
I would like to note that all our scrollable controls use RadScrollBar and can be scrolled easily with managed code. Only RadPanel scrolls like Microsoft's Panel and cannot be scrolled easy.
We plan to switch RadPanel to use RadScrollBars in one of the next major releases (no deadline is set as of now).
Best wishes,
Angel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Yes, you will have to use SendMessage(). I tried to use VerticalScroll.Value for RadPanel (and for Microsoft's Panel) but the scrollbar and the content of the panel were not synchronized well.
I would like to note that all our scrollable controls use RadScrollBar and can be scrolled easily with managed code. Only RadPanel scrolls like Microsoft's Panel and cannot be scrolled easy.
We plan to switch RadPanel to use RadScrollBars in one of the next major releases (no deadline is set as of now).
Best wishes,
Angel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Santiago Aragones
Top achievements
Rank 1
answered on 05 May 2008, 08:56 AM
Hi,
There is an easy way to make default win scrollbars to work? I forced them to show on a RadGridView but they just didn't do anything. I'm using your examples to make them work, but i still have to work its behavior.
When will be the best moment (loading, painting,...) to get radscrollbars values to set them on win ones?
Can i do the same for a RadTreeView (the next control i have to override its scrollbars)?
Thx.
There is an easy way to make default win scrollbars to work? I forced them to show on a RadGridView but they just didn't do anything. I'm using your examples to make them work, but i still have to work its behavior.
When will be the best moment (loading, painting,...) to get radscrollbars values to set them on win ones?
Can i do the same for a RadTreeView (the next control i have to override its scrollbars)?
Thx.
0
Hello Santiago Aragones,
If you want to use MS scrollbars instead of ours in RadGridView or RadTreeView, you have to do the following:
Angel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
If you want to use MS scrollbars instead of ours in RadGridView or RadTreeView, you have to do the following:
- Get the internal radscrollbars
For RadTreeView you can get them this way:
this.verticalScroll = this.radTreeView1.Controls[0] as RadVScrollBar; this.horizontalScroll = this.radTreeView1.Controls[1] as RadHScrollBar; - Handle the Scroll or ValueChanged event of the MS scrollbars. For vertical scrolling, you can use code such as this one:
this.radTreeView1.ScrollBy(e.OldValue-e.NewValue);
There is no specialized method for horizontal scrolling so you will need more code for it:
if (this.radTreeView1.IsEditing) { this.radTreeView1.EndEdit(true); } this.radTreeView1.ScrollPosition = new Point(-e.NewValue, this.radTreeView1.ScrollPosition.Y); this.radTreeView1.TreeViewElement.PositionOffset = new SizeF(-e.NewValue, 0); - Synchronize the outlook of the MS scrollbars with the internal ones - handle the ScrollParameterChanged event of the element:
this.verticalScroll = this.radTreeView1.Controls[0] as RadVScrollBar; this.horizontalScroll = this.radTreeView1.Controls[1] as RadHScrollBar;
and use code such as this one:
void scrollParameterChanged(object sender, EventArgs e) { RadScrollBarElement srollElement = (RadScrollBarElement)sender; ScrollBarParameters parameters = srollElement.GetParameters(); if (srollElement.ScrollType == ScrollType.Vertical) { this.vScrollBar1.Minimum = parameters.Minimum; this.vScrollBar1.Maximum = parameters.Maximum; this.vScrollBar1.SmallChange = parameters.SmallChange; this.vScrollBar1.LargeChange = parameters.LargeChange; } else { this.hScrollBar1.Minimum = parameters.Minimum; this.hScrollBar1.Maximum = parameters.Maximum; this.hScrollBar1.SmallChange = parameters.SmallChange; this.hScrollBar1.LargeChange = parameters.LargeChange; } }
External scrolling in the case of RadGridView was described in an earlier post.
I hope this helps. Contact me again if you need further assistance.
Angel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Santiago Aragones
Top achievements
Rank 1
answered on 08 May 2008, 06:56 AM
thx, i already succeded.
0
Craig
Top achievements
Rank 1
answered on 12 Jan 2011, 01:08 PM
Do you have the VB.net code for managing a gridview with radscrollbars?
I've tried working out the conversion to no avail.
Many Thanks
I've tried working out the conversion to no avail.
Many Thanks
0
Hi Craig,
Thank you for writing.
Please refer to this help article which demonstrates the scrolling functionality in RadGridView.
I hope you find this information helpful.
If there is anything else I can assist you with, do not hesitate to contact me back with more details of your scenario.
Best wishes,
Stefan
the Telerik team
Thank you for writing.
Please refer to this help article which demonstrates the scrolling functionality in RadGridView.
I hope you find this information helpful.
If there is anything else I can assist you with, do not hesitate to contact me back with more details of your scenario.
Best wishes,
Stefan
the Telerik team