PlanetSquires Forums

Support Forums => General Board => Topic started by: Stephane Fonteyne on September 14, 2013, 08:20:43 AM

Title: Max Value of the Scrollbar not correct result
Post by: Stephane Fonteyne on September 14, 2013, 08:20:43 AM
Paul,

Can you please check this code but it give not the correct result as max value if the scrollbar move to the end right.



In DesignTime:

Set the scrollbar in the property tabpage of FireFly SDK Designer:

LargeChange : 5
Max : 1000
Min  : 0
Value : 0





'Runtime code
'--------------------------------------------------------------------------------
Function DLGFORM1_HSCROLL1_WM_HSCROLL ( _
                                      ControlIndex  As Long,  _  ' index in Control Array
                                      hWndForm      As Dword, _  ' handle of Form
                                      hWndControl   As Dword, _  ' handle of Control
                                      nScrollCode   As Long,  _  ' scroll bar value
                                      nPosition     As Long   _  ' current scroll bar position
                                      ) As Long

    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' BEGIN OF THE DEFAULT SCROLLBAR EVENTS CODE
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   
    Local ScrollBarPos  As Dword
    Local si            As SCROLLINFO

    si.cbSize = SizeOf(si)
    si.fMask  = %SIF_All
    '=========================================================
    GetScrollInfo hWndControl, %SB_Ctl, ByVal VarPtr(si)
    '=========================================================

    Select Case nScrollCode
        Case %SB_LineUp
            Decr si.nPos
        Case %SB_LineDown
            Incr si.nPos
        Case %SB_ThumbPosition
            si.nPos = nPosition
        Case %SB_PageUp
            si.nPos -= si.nPage
        Case %SB_PageDown
            si.nPos += si.nPage
    End Select

    '=================================================================
    SetScrollInfo hWndControl, %SB_Ctl, ByVal VarPtr(si), %TRUE
    '=================================================================
   
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ' END OF THE DEFAULT SCROLLBAR EVENTS CODE
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    '********************************************************************'
    'Your User Code                                                   '
    '********************************************************************'
   
    Local lPos As Long
   
    lPos = FF_ScrollBar_GetPos (HWND_DLGFORM1_HSCROLL1)
    FF_TextBox_SetText(HWND_DLGFORM1_TEXT1, Str$(lPos))
End Function


I set the max value to 1000 and see in runtime 996 why ?????. How can I see the result 0 to 1000 and not 0 to 996?

Can somebody help me how I can solve this or is that an bug in FireFly?

Kind regards
Title: Re: Max Value of the Scrollbar not correct result
Post by: Elias Montoya on September 14, 2013, 05:07:51 PM
If you set the value of a scrollbar to a certain maximum, it might not reach it to keep some elements visible. The remaining 4 elements must be the ones visible.

for example:

1
2
... etc...
994
995
996      <-----starts visible elements.
997
998         
999
1000    <----ends visible elements.


Its no bug in firefly, its a flaw on your side. If you want your element to be 1000 exactly, then set the number of elements per page (largechange) to 1.

By the way, i suggest you to use the B word more carefully, nobody likes to constantly be blamed for the coding errors of others. :) You are more likely to get help that way.

:)
Title: Re: Max Value of the Scrollbar not correct result
Post by: Stephane Fonteyne on September 14, 2013, 05:26:31 PM
Quote from: Elias Montoya on September 14, 2013, 05:07:51 PM
If you set the value of a scrollbar to a certain maximum, it might not reach it to keep some elements visible. The remaining 4 elements must be the ones visible.

for example:

1
2
... etc...
994
995
996      <-----starts visible elements.
997
998         
999
1000    <----ends visible elements.


Its no bug in firefly, its a flaw on your side. If you want your element to be 1000 exactly, then set the number of elements per page (largechange) to 1.

By the way, i suggest you to use the B word more carefully, nobody likes to constantly be blamed for the coding errors of others. :) You are more likely to get help that way.

:)

Thanks Elias for you help

Kind regards
Stephane
Title: Re: Max Value of the Scrollbar not correct result
Post by: Elias Montoya on September 14, 2013, 05:27:51 PM
No problem stephane. :)

Cheers! :)