Thread: Trackbar question

  1. #1
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    310

    Trackbar question

    I have a horizontal trackbar and a static control. What I need is to while I move the slide the current value reflects on the static control...
    While I already set the rang value:
    Code:
    SendDlgItemMessage(hWndDlg,IDC_SLIDER1,TBM_SETRANGE,TRUE,MAKELONG(1,90));
    SendDlgItemMessage(hWndDlg,IDC_SLIDER1,TBM_SETBUDDY,FALSE,(LPARAM)GetDlgItem(hWndDlg,IDC_CURPOS));
    Now left is to update the static control text with the current trackbar pos.
    I aready tried with:
    NM_RELEASEDCAPTURE but the notify event is only when I release the mouse button.
    Do I need to subclass trackbar and capture some WM_HSCROLL or WM_MOUSEMOVE? Do I have to use TBM_SETBUDDY with some extra code?
    Please help
    Last edited by Joelito; 02-24-2011 at 01:47 PM.
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    I haven't used trackbars in a while (I just us a scroobar instead) but I believe that capturing the TB_THUMBTRACK message will let you update the static control, more or less on the fly.

  3. #3
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    310
    Thanks CommonTater, you were close, trackbar uses also WM_HSCROLL and WM_VSCROLL
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Question bout my work
    By SirTalksAlots in forum C Programming
    Replies: 4
    Last Post: 07-18-2010, 03:23 PM
  2. A question about a question
    By hausburn in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2010, 05:24 AM
  3. Controlling a trackbar
    By bigdan43 in forum C++ Programming
    Replies: 1
    Last Post: 08-24-2005, 11:24 AM
  4. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  5. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM