This is a migrated thread and some comments may be shown as answers.

How to determine item is click in VB.net

8 Answers 137 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
YING JANG LIN
Top achievements
Rank 1
YING JANG LIN asked on 04 Apr 2010, 04:37 PM
Hi,

below is my code is add item to carousel

        RadCarousel1.Items.Add(ButtonBox1)
        RadCarousel1.Items.Add(ButtonBox2)
        RadCarousel1.Items.Add(ButtonBox3)
        RadCarousel1.Items.Add(ButtonBox4)

Then, my question is

1,How to catch which above button is click in below  subroutin ,

Private Sub RadCarousel1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadCarousel1.SelectedIndexChanged
            

    End Sub

2, mouse over item can change mouse icon to hand that item move to path of specific position whcih predefine.
 
Hope you can me.

Thanks

8 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 07 Apr 2010, 03:07 PM
Hi YING JANG LIN,
 
You can get the selected button using the Carousel's SelectedItem in RadCarousel1_SelectedIndexChanged:
 
me.radCarousel1.SelectedItem

About the second question you can change the mouse cursor using each Carousel item button's events MouseHover and MouseLeave. Refer to the code below:
 
AddHandler buttonBox1.MouseHover, AddressOf imageItem_MouseHover                AddHandler buttonBox1.MouseLeave, AddressOf imageItem_MouseLeave
 
Private Sub imageItem_MouseLeave(ByVal sender As Object, ByVal e As EventArgs)
Cursor = Cursors.Default       
End Sub
Private Sub imageItem_MouseHover(ByVal sender As Object, ByVal e As EventArgs)          
 Cursor = Cursors.Hand       
End Sub
 
but you cannot move an item to the specific positions with Drag&Drop, because coordinates for items are evaluated only from RadCarouselCalculator. Please, excuse us for the inconvenience.


Sincerely yours,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
YING JANG LIN
Top achievements
Rank 1
answered on 07 Apr 2010, 03:35 PM

Hi,Peter

Thank your resolution and help.

for question 1

Private Sub RadCarousel1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadCarousel1.SelectedIndexChanged

        when mouse click at button1
 

        MsgBox(Me.RadCarousel1.SelectedItem)    <=== may be show <button1.text> ,but show <Telerik.WinControls.UI.RadButtonElement

       click at button2

       have same result
 
       MsgBox(Me.RadCarousel1.SelectedItem)    <=== may be show <button2.text> ,but show <Telerik.WinControls.UI.RadButtonElement

End Sub


Hope can help me
Thanks

0
Peter
Telerik team
answered on 08 Apr 2010, 04:34 PM
Hi YING JANG LIN,

Thanks for the provided information.
 
You should cast the SelectedItem to RadButtonElement and show the Text property of the RadButtonElement:
 
Dim selectedButton as RadButtonElement
selectedButton  = CType(radCarousel.SelectedItem, RadButtonElement)
MessageBox.Show( selectedButton.Text )
Hope this helps.

Regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
YING JANG LIN
Top achievements
Rank 1
answered on 09 Apr 2010, 02:35 AM
Hi,Peter

thanks your help.

Below is exact code worked for this question and shared to other.

Private Sub RadCarousel1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadCarousel1.SelectedIndexChanged
        Dim selectedButton As RadButtonElement
        selectedButton = CType(Me.RadCarousel1.SelectedItem, RadButtonElement)
        MessageBox.Show(selectedButton.Text)
End Sub

1,another question is code add to Sub RadCarousel1_SelectedItemChanged cann't work That Hope you can tell me what?
2,When Clicked button_next also fire RadCarousel1_SelectedIndexChanged,you can see hardcopy screen at attach file?
3,I hope program run like Telerik run demo Integration section function?

Thanks Peter
0
Peter
Telerik team
answered on 13 Apr 2010, 01:05 PM
Hello Ying,

The reason that SelectedItemChanged is not working as SelectedIndexChanged is virtualization - this event also fires with non virtualized items, so you can handle SelectedIndexChanged instead of SelectedItemChanged

I cannot find any attached files in your ticket? Can you clarify what do you mean with "run like Telerik run demo Integration section function?" - we do not have any carousel examples in integration section in our example application.

Regards,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
YING JANG LIN
Top achievements
Rank 1
answered on 13 Apr 2010, 02:10 PM
Hi,Peter

I hope get hardcopy of attached file of sample code in Vb.net,
Those samples are satisifiable demand for me.


Thanks

0
Accepted
Vassil Petev
Telerik team
answered on 16 Apr 2010, 09:37 AM
Hi YING JANG LIN,

This carousel is a custom implementation for our demos only - this implementation is not supported. Please, use RadCarousel instead.


All the best,
Vassil
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
YING JANG LIN
Top achievements
Rank 1
answered on 16 Apr 2010, 02:55 PM
Hi,Vassil

Thanks

YC
Tags
Carousel
Asked by
YING JANG LIN
Top achievements
Rank 1
Answers by
Peter
Telerik team
YING JANG LIN
Top achievements
Rank 1
Vassil Petev
Telerik team
Share this question
or