Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - Determine Tab Containing a Control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Determine Tab Containing a Control

 Post Reply Post Reply
Author
Message
jgordon428 View Drop Down
Groupie
Groupie


Joined: 11 June 2009
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote jgordon428 Quote  Post ReplyReply Direct Link To This Post Topic: Determine Tab Containing a Control
    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.
Back to Top
daniel_r View Drop Down
Groupie
Groupie


Joined: 06 October 2009
Location: Germany
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote daniel_r Quote  Post ReplyReply Direct Link To This Post 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

 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.