Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Sliderbar Problem

Sliderbar Problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpdesignjson
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    scody
    wrote on last edited by
    #1

    Hi, I am new to windows programming. In my code I would require to change the slider bar position (I am actually invoking the sliderbar from UI using win32 API, so I donot have source code of the application), which I have accomplished by sending message. ::SendMessage( aControlHWnd, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM)(LONG) aPosition ); The problem is with the updation of the window according to the new sliderbar position, I mean, when I change the position of the sliderbar it is changed visually, but the corresponding values in other objects (like textbox showing the value related to this sliderbar) are not updated. To accomplish this I tried ::NotifyWinEvent( EVENT_OBJECT_VALUECHANGE, theDialogHWnd, OBJID_HSCROLL, CHILDID_SELF ); where theDialogHWnd is the handle for the dialog window containing the sliderbar and the textbox, but it didn't work. I am not sure if the parameters I am using are correct, or the event I am trying to notify, or may be my approach to the problem itself is wrong. I do understand that this can be easily accomplished by sending a keyboard or mouse event, but I am tryin not to use it. Any help would be greatly appriciated. Thanks.

    L 1 Reply Last reply
    0
    • S scody

      Hi, I am new to windows programming. In my code I would require to change the slider bar position (I am actually invoking the sliderbar from UI using win32 API, so I donot have source code of the application), which I have accomplished by sending message. ::SendMessage( aControlHWnd, TBM_SETPOS, (WPARAM) (BOOL) TRUE, (LPARAM)(LONG) aPosition ); The problem is with the updation of the window according to the new sliderbar position, I mean, when I change the position of the sliderbar it is changed visually, but the corresponding values in other objects (like textbox showing the value related to this sliderbar) are not updated. To accomplish this I tried ::NotifyWinEvent( EVENT_OBJECT_VALUECHANGE, theDialogHWnd, OBJID_HSCROLL, CHILDID_SELF ); where theDialogHWnd is the handle for the dialog window containing the sliderbar and the textbox, but it didn't work. I am not sure if the parameters I am using are correct, or the event I am trying to notify, or may be my approach to the problem itself is wrong. I do understand that this can be easily accomplished by sending a keyboard or mouse event, but I am tryin not to use it. Any help would be greatly appriciated. Thanks.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      When slider bars are moved they post either a WM_HSCROLL or a WM_VSCROLL to its parent. Try posting these messages to the parent window of the slider bar. To determine which message should be sent check the slider control for the style TBS_VERT. See if something like this works: int iPos = m_slider->GetPos(); if (m_slider->GetStyle() & TBS_VERT) pWnd->PostMessage(WM_VSCROLL, (WPARAM)((iPos << 16) | SB_THUMBPOSITION), (LPARAM)NULL); else pWnd->PostMessage(WM_HSCROLL, (WPARAM)((iPos << 16) | SB_THUMBPOSITION), (LPARAM)NULL);

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups