PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: jthompson on March 03, 2007, 10:37:25 PM

Title: Same TabChild (Multiple Times) On TabControl
Post by: jthompson on March 03, 2007, 10:37:25 PM
I've got a listview on a form (tabchild/yes) that I want to display as a
tabcontrol's child for more than one form.  Based on the tab they
select I will delete/repopulate the listview based on the name of the
tab they clicked.

I've tried doing this, but I can only view the listview on the very last
tab.  Is it possible to do this without having to make separate forms
(all exactly the same) for each tab child?

Thanks!

-John
Title: Same TabChild (Multiple Times) On TabControl
Post by: jthompson on March 03, 2007, 11:52:34 PM
I started to think it was a GetDlgItem
issue, so I started messing around
more.  Here's more information...

I have an MDI application.  mdiMenu is an mdi child form.  It has a tab control on it.  The tab control uses the form tabMenu as its children forms.  tabMenu has a listview called lvMenu on it.

When on mdiMenu and changing tabs, how do I get the handle to the listview?

I've tried recursive GetDlgItem(), but
either I'm doing it wrong or I'm
looking in the wrong place.

Thanks!

-John
Title: Same TabChild (Multiple Times) On TabControl
Post by: TechSupport on March 04, 2007, 06:51:18 PM
Hi John,

I am not 100% sure what you want to do but the following code will move your ListView among the various Tab Control child forms as each tab is clicked. The trick is SetParent.

Function FRMMAINFORM_TABCONTROL1_TCN_SELCHANGE ( _
                                              ControlIndex  As Long,      _  ' index in Control Array
                                              hWndForm      As Dword,     _  ' handle of Form
                                              hWndControl   As Dword,     _  ' handle of Control
                                              ByVal lpNMHDR As NMHDR Ptr  _  ' pointer to NMHDR
                                              ) As Long

  Local nTabNumber  As Long
  Local hWndTabForm As Long
 
  ' Move the ListView to the newly selected Tab
  nTabNumber = FF_TabControl_GetSelectedTab(hWndControl)
 
  Select Case nTabNumber
     Case 0:  hWndTabForm = HWND_FRMGENERAL
     Case 1:  hWndTabForm = HWND_FRMENVIRONMENT
     Case 2:  hWndTabForm = HWND_FRMOPTIONS
  End Select
     
  SetParent HWND_FRMGENERAL_LVMENU, hWndTabForm
 
  ' Position the ListView as needed
  'SetWindowPos HWND_FRMGENERAL_LVMENU, %HWND_TOP, ...,...,...,
 
End Function