PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Stephane Fonteyne on September 13, 2013, 07:43:47 PM

Title: Example of a scrollbar in SDK and DDT
Post by: Stephane Fonteyne on September 13, 2013, 07:43:47 PM
Dear support,

I don't find any sample how I can written code for control the scrollbar. I would like read the contents of the scrollbar en place it in an textbox. I don't know in witch event place this code.

What kind of code put it in the eventhandler :



Function FORM1_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

What code do I please here???

End Function


Can somebody here post examples for using the FireFly SDK Designer in SDK and DDT style?

Thanks
Stephane
Title: Re: Example of a scrollbar in SDK and DDT
Post by: Paul Squires on September 13, 2013, 08:32:29 PM
Quote from: Stephane Fonteyne on September 13, 2013, 07:43:47 PM
I don't find any sample how I can written code for control the scrollbar.
You didn't look very hard because you have asked this question before at least twice and it was answered:
http://www.planetsquires.com/protect/forum/index.php?topic=2955.msg21891
http://www.planetsquires.com/protect/forum/index.php?topic=2898.msg21577

Here is some more scroll code: http://www.planetsquires.com/protect/forum/index.php?topic=2007.msg16211

Title: Re: Example of a scrollbar in SDK and DDT
Post by: Paul Squires on September 13, 2013, 08:33:55 PM
Quote from: Stephane Fonteyne on September 13, 2013, 07:43:47 PM
Can somebody here post examples for using the FireFly SDK Designer in SDK and DDT style?

For DDT examples you should ask your question on the PowerBasic forum. FireFly does not use DDT, never has and never will.
Title: Re: Example of a scrollbar in SDK and DDT
Post by: Stephane Fonteyne on September 14, 2013, 03:36:41 AM
Paul,

I try to rewritten te code but the scrollrange large is not updated. What's here the solution for. I init the SCROLLINFO structure in the WM_CREATE handle.



'--------------------------------------------------------------------------------
FUNCTION FORM1_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



    'nScrollCode
   
    LOCAL si        AS SCROLLINFO
   
    si.cbSize   = SIZEOF(si)
    si.fMask    = %SIF_ALL
    '=========================================================='
    GetScrollInfo hWndControl, %SB_CTL, BYVAL VARPTR(si)       '
    '=========================================================='

    SELECT CASE nScrollCode
        CASE %SB_LINELEFT
            DECR si.nPos
        CASE %SB_LINERIGHT
            INCR si.nPos
        CASE %SB_PAGELEFT
            si.nPos -= si.nPage
        CASE %SB_PAGERIGHT
            si.nPos += si.nPage
        CASE %SB_THUMBPOSITION
            si.nPos = nPosition
        CASE %SB_THUMBTRACK
            si.nPos = nPosition
    END SELECT

    '================================================================='
    SetScrollInfo hWndControl, %SB_CTL, BYVAL VARPTR(si), %TRUE '
    '================================================================='

END FUNCTION


'--------------------------------------------------------------------------------
FUNCTION FORM1_TIMER1_WM_TIMER ( _
                               hWndForm      AS DWORD, _  ' handle of Form
                               wTimerID      AS DWORD  _  ' the timer identifier
                               ) AS LONG

    LOCAL pulseTime AS LONG

    pulseTime = FF_ScrollBar_GetPos (HWND_FORM1_HSCROLL1)
    FF_TextBox_SetText(HWND_FORM1_LABEL1, STR$(pulseTime))
    FF_TextBox_SetText(HWND_FORM1_LABEL2, STR$(pulseTime))

END FUNCTION


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

    STATIC lMin     AS LONG
    STATIC lMax     AS LONG
    STATIC lPos     AS LONG
    STATIC lPage    AS LONG
    LOCAL  si       AS SCROLLINFO

    si.cbSize = LEN(SCROLLINFO)
    si.fMask  = %SIF_ALL
    '========================================'
    si.nMin   = 0                            '
    si.nMax   = 50                           '
    si.nPos   = 2                            '
    si.nPage  = 10                           '
    '========================================'

    '================================================================='
    SetScrollInfo hWndForm, %SB_CTL, BYVAL VARPTR(si), %TRUE          '
    '================================================================='

    HWND_FORM1_TIMER1 = SetTimer(HWND_FORM1, IDC_FORM1_TIMER1, 2000, BYVAL %Null)

END FUNCTION
                           

Title: Re: Example of a scrollbar in SDK and DDT
Post by: Elias Montoya on September 14, 2013, 04:00:32 AM

Some more coding is required. Read ALL the required code in the examples that Paul posted. :)