Events not working?

9 posts, 0 answers
  1. Daniel Plomp
    Daniel Plomp avatar
    130 posts
    Member since:
    Feb 2004

    Posted 30 Nov 2006 Link to this post

    Hello all,

    When swich from one tab item to another tab item I was expecting that the event 'TabIndex_Changed' or 'TabPostition_Changed' was fired. But nothing happened.

    How can I check if a user is changing from one tab to another?

    Thanks,
    Daniel
  2. Chris
    Admin
    Chris avatar
    221 posts

    Posted 30 Nov 2006 Link to this post

    Hi Daniel,

    The TabsPositionChanged event is fired when the TabPosition property changes. The TabPosition property defines the position of the tab items relatively to the base area. The TabIndexChanged event is fired when the TabIndex property changes and basically every WinForms control has this property and this event. The TabIndex property is used to get or set the tab order of the respective control, so when you click the TAB key the focus changes from one control to another.
    The event which you should use is named TabSelected. It is fired when a tab is selected either by clicking on it or programmatically using the API.
    I hope this information helps.

    Greetings,
    Chris
    the telerik team

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mukunda Manoj
    Mukunda Manoj avatar
    35 posts
    Member since:
    Apr 2006

    Posted 30 Nov 2006 Link to this post

    There is a click event on tab, which fires when a tab is clicked.
  5. Daniel Plomp
    Daniel Plomp avatar
    130 posts
    Member since:
    Feb 2004

    Posted 30 Nov 2006 Link to this post

    Okay, I also found out that 'TabSelected' is the event I need. But... I was expecting that the 'Telerik.WinControls.UI.TabEventArgs args' would contain the information about the tab that was currently selected.

    But e.g. the .name property has a value of "".
    So, is there a SelectedIndex property or something which will let me readout the index of the selected tab?

    I should read the manual first I guess, but most of the time using the telerik suite, it is pretty straight forward.

    Allthough I couldn't find event examples...
    Thanks,
    Daniel
  6. Chris
    Admin
    Chris avatar
    221 posts

    Posted 30 Nov 2006 Link to this post

    Hello Daniel,
    You can use the TabItem property of the TabEventArgs to get the currently selected tab item. You could also access the SelectedTab property of the TabStrip control. If you would like to get the index of the selected tab item in the tabs collection you could use the Items.IndexOf method.
    e.g.
    radTabStrip1.Items.IndexOf(args.TabItem)

    Regards,
    Chris
    the telerik team
  7. Marturo77
    Marturo77 avatar
    7 posts
    Member since:
    May 2007

    Posted 18 May 2007 Link to this post

    Hi.
     
    I use this instrucction and receive the error:  

    "Argument '1': cannot convert from 'Telerik.WinControls.RadElement' to 'Telerik.WinControls.RadItem'"

    I use your instrucction inside of the radTabStrip_TabSelected event.

    Can you help me?

    Thanks
  8. Mike
    Mike avatar
    524 posts
    Member since:
    Feb 2007

    Posted 18 May 2007 Link to this post

    Indeed, I tried the same and got the same compile time error. It appears that TabItem is of type RadElement, while the Items collection expects RadItem type. Please, try the following code instead - it worked in my case, hopefully this is applicable in your setup as well.

    C#
    private void radTabStrip1_TabSelected(object sender, TabEventArgs args) 
        int index = radTabStrip1.Items.IndexOf(args.TabItem as Telerik.WinControls.RadItem);         


    VB.NET
    Private Sub radTabStrip1_TabSelected(sender As Object, args As TabEventArgs) 
       Dim index As Integer = radTabStrip1.Items.IndexOf(CType(args.TabItem, Telerik.WinControls.RadItem )) 
    End Sub 
     
     
     
     

  9. Mike
    Mike avatar
    524 posts
    Member since:
    Feb 2007

    Posted 19 May 2007 Link to this post

    An Index property will come handy in this situation... most System.Windows.Forms child items have Index properties and we are used to that.

    e.g.

                System.Windows.Forms.MenuItem item = new System.Windows.Forms.MenuItem();
                item.Index ..
  10. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 21 May 2007 Link to this post

    Hello Mike,

    At present you could use the GetIndex method of TabStripElement which accepts a TabItem as a parameter and returns an integer with the index in the collection of that TabItem. We will add the Index property of TabItem in our next release of RadControls for WinForms.

    If you would like to get the selected tab you could handle the TabSelected event:
     
    TabItem item = args.TabItem as TabItem; 


        // Place your code here 
     


    I hope that this helps. If you need any further assistance please do not hesitate to write us back.

     
    Sincerely yours,
    Ray
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for WinForms is Visual Studio 2017 Ready