Uh oh.  I included my code... I feel.... dirty...  just kidding, hope it
helps

First you need to add a scrollbar to your form.  You need to attach it to
the field or object your using it with.  Then you need to handle the events
appropriately.

I have 

#include "Window.h"  //for DirectionType for use with scrollbar

///Scroll - in the event handler for the form that you are currently using
case sclExitEvent: //scrollbar used
        UpdateScrolledField(event->data.sclExit.newValue);
        handled = true;
        break;

//attach to field
///scroll
ScrollBarPtr sbpScroll;
UInt16 iVPos;
UInt16 iNLines;
UInt16 iVLines;
UInt16 iMax;    
sbpScroll =(ScrollBarType*) FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP,
SCROLL_FIELD));
FldGetScrollValues(fldP, &iVPos, &iNLines, &iVLines);
iMax = (iNLines > iVLines) ? iNLines - iVLines : 0;
//set the scrollbar
SclSetScrollBar(sbpScroll, iVPos, 0, iMax, iVLines);


void UpdateScrolledField(UInt16 iNewPos)
{
        FieldPtr fldP;
        UInt16 iLinesToScroll;
        UInt16 iPos;
        WinDirectionTag dtDir;
        UInt16 iTxtHeight;
        UInt16 iFldHeight;
        FormPtr frmP = FrmGetActiveForm();

        fldP = (FieldType *) FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP
,TXTContent));
        
        FldGetScrollValues(fldP, &iPos, &iTxtHeight, &iFldHeight);
        
        if (iNewPos >= iPos)
        {
                dtDir = winDown;
                iLinesToScroll = iNewPos - iPos;
        }
        else
        {
                dtDir = winUp;
                iLinesToScroll = iPos - iNewPos;
        }
        
        FldScrollField(fldP, iLinesToScroll, dtDir);

}




-----Original Message-----
From: Marilia Mendes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 29, 2004 1:59 PM
To: Palm Developer Forum
Subject: scrollbar - CodeWarrior

how I make to use scrollbar in my applications in the
CodeWarrior? Exists a codification?
Thanks,
Mar�lia



______________________________________________________________________

Yahoo! Messenger - Fale com seus amigos online. Instale agora! 
http://br.download.yahoo.com/messenger/

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/

--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to