Immediate update for Slider.gadget

Online Status

I've set up a slider like this

      LAYOUT_AddChild, m_ppGadgets[GID_SLI_FROM] = NewObject(SLIDER_GetClass(), NULL,
        GA_ID, GID_SLI_FROM,
        GA_RelVerify, TRUE,
        GA_TabCycle, TRUE,
        SLIDER_Orientation, SORIENT_HORIZ,
        SLIDER_Min, 1,
        SLIDER_Max, MAXNAMELEN,
        SLIDER_Level, 1,
        SLIDER_LevelFormat, "%2ld",
        SLIDER_LevelMaxLen, 3,
        SLIDER_LevelDomain, "222",
      TAG_DONE),

It works and sends its items after a level change is finsihed by clicking on it or release the left mouse button.

But I would like the slider to send its events while I move it with the mouse and not only after releasing the left mouse button.

How could I achieve this?

Online Status

Have you tried SLIDER_DispHook?

Online Status

Not yet, but I'll have a look at it. Thank you:-)

Online Status

So, I tried it with SLIDER_DispHook:

struct Hook m_SlidersHook;

// Needs '#include <clib/compiler-specific.h>' to work with sasc and gcc
void __ASM__ __SAVE_DS__ SliderMsgFunc(__REG__(a0, struct Hook *pHook),
                                       __REG__(a2, Object *pWindow),
                                       __REG__(a1, struct Message *pMsg))
{
  ULONG fromLevel;
  ULONG toLevel;
  MyInstanceData* pInstanceData = (MyInstanceData*)pHook->h_Data;

  ...
}

...

m_SliderHook.h_Entry = (ULONG (* )())SliderMsgFunc;
m_SliderHook.h_SubEntry = NULL;
m_SliderHook.h_Data = pMyInstanceData;

...

LAYOUT_AddChild, m_ppGadgets[GID_SLI_FROM] = NewObject(SLIDER_GetClass(), NULL,
  GA_ID, GID_SLI_FROM,
  GA_TabCycle, TRUE,
  // GA_RelVerify, TRUE,
  SLIDER_DispHook, &m_SliderHook,
  SLIDER_Orientation, SORIENT_HORIZ,
  SLIDER_Min, 1,
  SLIDER_Max, MAXNAMELEN,
  SLIDER_Level, 1,
TAG_DONE),

And it works. So thanks again for the hint!

Online Status

No problem. Good to see it is working for you, and thanks for sharing some details for others to learn.