Print Page | Close Window

Determine Tab Containing a Control

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=14927
Printed Date: 23 November 2024 at 2:42am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Determine Tab Containing a Control
Posted By: jgordon428
Subject: Determine Tab Containing a Control
Date Posted: 07 August 2009 at 1:53pm
I have a spell checker routine that will scan through all the textboxes in a form, and when it finds a misspelling, it will display the spelling correction dialogue. I have a form that uses the XtremeSuite TabControl. What I would like to do, is when I find a textbox with a misspelled word, to set the current tab to the control's tab, so the user can see the tab page that contains the control in question. With previous tab controls I've used, there was a GetTab(hWnd as long) function, where you could pass it the handle to a control, and it would return the relevant tab number. I don't believe there is an equivalent function with these controls, so I was hoping for a bit of help.

Is it possible to add in this functionality? Is there a different way I could go about doing this, for instance iterating through a collection of controls within each tab or tabControlPage? I would prefer not to use a hack like storing the tab index in each textbox tag property if at all possible.

Thank you.



Replies:
Posted By: daniel_r
Date Posted: 07 October 2009 at 6:48am
You have to walk all the parents/containers of that control until you find a TabControlPage.

I did the same just yesterday for VB6:

Private Function GetTab(Control As Control) As TabControl

  Dim c As Control
 
  Set c = Control.Container
  Do While Not (c Is Nothing)
    If TypeOf c Is TabControlPage Then
      Set GetTab = c
      Exit Function
    Else
      Set c = c.Container
    End If
  Loop
 
End Function

 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net