Example of a scrollbar in SDK and DDT

Started by Stephane Fonteyne, September 13, 2013, 07:43:47 PM

Previous topic - Next topic

Stephane Fonteyne

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

Paul Squires

Paul Squires
PlanetSquires Software

Paul Squires

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.
Paul Squires
PlanetSquires Software

Stephane Fonteyne

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
                           

Stephane Fonteyne
Ba. Elektronica - ICT
GSM : +32-xxxxxxxxxx
PowerBasic Developer & Hardware Support

Elias Montoya


Some more coding is required. Read ALL the required code in the examples that Paul posted. :)
Win7, iMac x64 Retina display 5K, i7-5820K 4.4 ghz, 32GB RAM, All updates applied. - Firefly 3.70.