Max Value of the Scrollbar not correct result

Started by Stephane Fonteyne, September 14, 2013, 08:20:43 AM

Previous topic - Next topic

Stephane Fonteyne

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
Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Elias Montoya

#1
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.

:)
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.

Stephane Fonteyne

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
Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Elias Montoya

Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.