Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

proportional scroll bar

DonotaloDonotalo Member Posts: 715
how to create a proportional scroll bar (whose length is proportional to its range)?
[hr][purple]~Donotalo()[/purple]

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : how to create a proportional scroll bar (whose length is
    : proportional to its range)?
    : [hr][purple]~Donotalo()[/purple]
    [blue]
    You have to use new functions SetScrollInfo()/GetScrollInfo() instead of old ones (SetScrollPos, SetScrollRange, etc.).
    [/blue]
  • DonotaloDonotalo Member Posts: 715
    : : how to create a proportional scroll bar (whose length is
    : : proportional to its range)?
    : : [hr][purple]~Donotalo()[/purple]
    : [blue]
    : You have to use new functions SetScrollInfo()/GetScrollInfo()
    : instead of old ones (SetScrollPos, SetScrollRange, etc.).
    : [/blue]
    i'm using SetScrollInfo(). but the scrollbar is not proportional. how to make proportional scrollbar using SetScrollInfo()?
    [hr][purple]~Donotalo()[/purple]
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [blue]Can you post the code?
    [/blue]
  • DonotaloDonotalo Member Posts: 715
    [code]
    class ScrollBar
    {
    const int what;
    int min, max, pos, page;
    int update_pos(HWND hwnd);
    public:
    ScrollBar(int w): what(w) {min = max = pos = 0; page = 5;}
    int get_pos() const {return pos;}
    int initialize(HWND hwnd, int mn, int mx);
    int linedown(HWND hwnd, int unit);
    int lineup(HWND hwnd, int unit);
    int pagedown(HWND hwnd);
    int pageup(HWND hwnd);
    int thumbtrack(HWND hwnd, int unit);
    };

    int ScrollBar::initialize(HWND hwnd, int mn, int mx) {
    SCROLLINFO si;

    if (max > 0) pos = (mx*pos)/max;
    min = mn;
    max = mx;

    si.cbSize = sizeof(SCROLLINFO);
    si.fMask = SIF_RANGE;
    si.nMin = min;
    si.nMax = max;
    return SetScrollInfo(hwnd, what, &si, true);
    }
    [/code]
    [purple]ScrollBar is a custom class i am using to track information about the scrollbar.
    [/purple]
    [hr][purple]~Donotalo()[/purple]
Sign In or Register to comment.