Two new wrappers for the Tab Control

Started by Jean-pierre Leroy, February 01, 2016, 02:23:26 PM

Previous topic - Next topic

Jean-pierre Leroy

Dear all,

Here are two news wrappers that I use regulary for the TabControl.

To get the child form handle of a TabControl = F(TabControl Handle, Position)

Function TabControlGetChildFormHandle(ByVal phWndControl As Dword, ByVal pPos As Byte) As Dword                                                                                                   
    Local lTCITEM As TC_ITEM
    lTCITEM.Mask = %TCIF_PARAM
    TabCtrl_GetItem(phWndControl, pPos, lTCITEM)
    Function = lTCITEM.lParam         
End Function   


To get the position in the Tabcontrol = F(TabControl Handle, Caption of the Tab))

Function TabControlGetPositionIndex(ByVal phWndControl As Dword, ByVal pTabText As String) As Long
                                                                                                   
    Local lI        As Long : lI = FF_TabControl_GetTabCount(phWndControl)
    Local lPosIndex As Long : lPosIndex = -1     
    Do       
        Decr lI
        If FF_TabControl_GetText (phWndControl, lI) = pTabText Then
            lPosIndex = lI
        End If                                     
    Loop Until lI = 0 Or lPosIndex <> -1       
    Function = lPosIndex       
End Function   


Hope that helps.

PS to Paul: feel free to add them to a new distribution/version of FireFly for PowerBASIC :-)

Robert Rioja

Thank you Jean-pierre.  I can use them.
Robert