PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: jthompson on April 25, 2008, 05:36:02 AM

Title: Can A TabControlChild Have WS_VSCROLL Setting?
Post by: jthompson on April 25, 2008, 05:36:02 AM
I've got a tab control child with a WS_VSCROLL window setting.  In the designer, it appears as expected.  When compiled, it doesn't appear.  I didn't know if this is a Windows limitation or if I'm doing something wrong.  I can email the project, if needed.  Thanks!
Title: Re: Can A TabControlChild Have WS_VSCROLL Setting?
Post by: TechSupport on April 25, 2008, 08:40:10 AM
Hi John,

Looks like the FireFly code generation is not honoring the WS_VSCROLL for TabControl child windows. You can manually set this via code. Add the code below to the WM_CREATE message handler of the TabControl Child form.



Function FRMOPTIONS_WM_CREATE ( _
                              hWndForm As Dword, _  ' handle of Form
                              ByVal UserData As Long _  'optional user defined Long value
                              ) As Long

   Local nStyle As Long
   
   nStyle = GetWindowLong( hWndForm, %GWL_STYLE )
   SetWindowLong hWndForm, %GWL_STYLE, nStyle Or %WS_VSCROLL
   SetWindowPos hWndForm, %HWND_NOTOPMOST, 0, 0, 0, 0, _
                %SWP_NOZORDER Or %SWP_NOSIZE Or _
                %SWP_NOMOVE Or %SWP_DRAWFRAME
   
   
End Function


Title: Re: Can A TabControlChild Have WS_VSCROLL Setting?
Post by: jthompson on April 25, 2008, 02:17:44 PM
Hi Paul!

Thanks for the fast response.  I added the code to the tab control child, but it still doesn't appear for me.  I reduced the width just in case the scrollbar would have been out of view, but it's not appearing. 

My WM_CREATE

'------------------------------------------------------------------------------------------------------------------------
FUNCTION TAB1_WM_CREATE ( _
                        hWndForm AS DWORD, _  ' handle of Form
                        BYVAL UserData AS LONG _  'optional user defined Long value
                        ) AS LONG

LOCAL nStyle AS LONG
   
    nStyle = GETWINDOWLONG( hWndForm, %GWL_STYLE )
    SETWINDOWLONG hWndForm, %GWL_STYLE, nStyle OR %WS_VSCROLL
    SETWINDOWPOS hWndForm, %HWND_NOTOPMOST, 0, 0, 0, 0, _
                %SWP_NOZORDER Or %SWP_NOSIZE Or _
                %SWP_NOMOVE Or %SWP_DRAWFRAME

SI4.cbSIze = LEN(SI4)
SI4.fMask  = %SIF_ALL
SI4.nMin   = 0
SI4.nMax   = 398
SI4.nPage  = 473
SETSCROLLINFO hWndForm, %SB_VERT, SI4, 1

END FUNCTION


If it matters, the tabs are not displayed automatically by FireFly's custom menu, but by your dynamic code at: http://planetsquires.com/support/index.php?topic=1731.0

Thanks!
Title: Re: Can A TabControlChild Have WS_VSCROLL Setting?
Post by: TechSupport on April 26, 2008, 04:56:19 PM
Hi John,

It appears that setting your nPage larger than nMax causes the scrollbar not to show. Try the following code and you will see that the scrollbar does indeed show:



   Local SI4    As SCROLLINFO
   Local nStyle As Long
   
   nStyle = GetWindowLong( hWndForm, %GWL_STYLE )
   SetWindowLong hWndForm, %GWL_STYLE, nStyle Or %WS_VSCROLL
   SetWindowPos hWndForm, %HWND_NOTOPMOST, 0, 0, 0, 0, _
                %SWP_NOZORDER Or %SWP_NOSIZE Or _
                %SWP_NOMOVE Or %SWP_DRAWFRAME
   
   SI4.cbSIze = SizeOf(SI4)
SI4.fMask  = %SIF_ALL
SI4.nMin   = 0
SI4.nMax   = 398
SI4.nPage  = 100  '473
SI4.nPos   = 0
SetScrollInfo hWndForm, %SB_VERT, SI4, 1   



Title: Re: Can A TabControlChild Have WS_VSCROLL Setting?
Post by: jthompson on April 26, 2008, 06:45:27 PM
Thank you so much!  That fixed it.  -John