How to determine item is click in VB.net

9 posts, 1 answers
  1. YING JANG LIN
    YING JANG LIN avatar
    14 posts
    Member since:
    Dec 2009

    Posted 04 Apr 2010 Link to this post

    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

  2. Peter
    Admin
    Peter avatar
    1142 posts
    Member since:
    Sep 2012

    Posted 07 Apr 2010 Link to this post

    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.

  3. YING JANG LIN
    YING JANG LIN avatar
    14 posts
    Member since:
    Dec 2009

    Posted 07 Apr 2010 Link to this post

    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

  4. Peter
    Admin
    Peter avatar
    1142 posts
    Member since:
    Sep 2012

    Posted 08 Apr 2010 Link to this post

    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.

  5. YING JANG LIN
    YING JANG LIN avatar
    14 posts
    Member since:
    Dec 2009

    Posted 08 Apr 2010 Link to this post

    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

  6. Peter
    Admin
    Peter avatar
    1142 posts
    Member since:
    Sep 2012

    Posted 13 Apr 2010 Link to this post

    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.

  7. YING JANG LIN
    YING JANG LIN avatar
    14 posts
    Member since:
    Dec 2009

    Posted 13 Apr 2010 Link to this post

    Hi,Peter

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


    Thanks

  8. Answer
    Vassil Petev
    Admin
    Vassil Petev avatar
    1766 posts
    Member since:
    Sep 2012

    Posted 16 Apr 2010 Link to this post

    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.

  9. YING JANG LIN
    YING JANG LIN avatar
    14 posts
    Member since:
    Dec 2009

    Posted 16 Apr 2010 Link to this post

    Hi,Vassil

    Thanks

    YC

Back to Top