Performance of TGDoubleHSlider

Hello,
My win32gdk application (3.10/0 Oct 2, 2003) has a TGDoubleHSlider in a resizable TGCompositeFrame inside a resizable TGMainFrame. Even without wiring the PositionChanged() signal to my own code, I notice that the performance appears to depend upon the area of the TGMainFrame: If the area is too large, the motion of the slider is very jerky: rapidly sliding the slider back and forth uses all the cpu. Below a magic threshold area, slider movement is smooth as silk and no cpu time, as seen by TaskManager’s icon in the tray, is used. Note: the effect appears to depend on area of TGMainFrame, not the length of slider. Has anyone else seen this? Is there a work-around?
Thanks,
Ed Oltman

Hi Ed,
could you post the code(small macro is better)?

Thanks. Regards. Valeriy

Hi Ed,
I do not see this effect with the following macro (thanks to Ilka)
win32gdk 3.10.01

Regards. Valeriy

//////////////////////////////////// slsr.C ///////////////////////////////////////
#include <TGClient.h>
#include <TGButton.h>
#include <TGLabel.h>
#include <TGSlider.h>
#include <RQ_OBJECT.h>

enum ESliderIdentifiers {
VSId1,
HSId1,
VSId2,
HSId2
};

class MyMainFrame {

RQ_OBJECT(“MyMainFrame”)

private:
TGMainFrame *fMain;

public:
MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~MyMainFrame();
};

MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
{
// Create a main frame
fMain = new TGMainFrame(p, w, h, kFitWidth | kFitHeight);

TGCompositeFrame *cf = new TGCompositeFrame(fMain, 10,10,kFitWidth | kFitHeight);

// Create horizontal slider
TGDoubleHSlider *hslider2 = new TGDoubleHSlider(cf, 150, kDoubleScaleBoth, HSId2,kFitWidth | kFitHeight,41216);
hslider2->SetRange(0,40);

TGCompositeFrame *cframe2 = new TGCompositeFrame(fMain, 100, 20, kHorizontalFrame | kFixedWidth);

exit = new TGTextButton(cframe2, "&Exit ",“gApplication->Terminate(0)”);
cframe2->AddFrame(exit, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,20,20,5,5));
fMain->AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX, 20, 20, 5, 1));

//— layout for buttons: top align, equally expand horizontally
fBly = new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 0, 0, 3, 0);

//— layout for the frame: place at bottom, right aligned
fBfly1 = new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 20, 10, 15, 0);

cf->AddFrame(hslider2, fBly);
fMain->AddFrame(cf, fBfly1);

fMain->SetWindowName(“Sliders Test”);
TGDimension size = fMain->GetDefaultSize();
fMain->Resize(size);

fMain->MapSubwindows();
fMain->Resize(fMain->GetDefaultSize());
fMain->MapWindow();
}

MyMainFrame::~MyMainFrame()
{
// Clean up all widgets, frames and layouthints that were used
fMain->Cleanup();
delete fMain;
}

void slsr()
{
// Popup the GUI…
new MyMainFrame(gClient->GetRoot(), 350, 80);
}

Hi Ed ,
I see effect. HandleMotion is not effective. It can be improved.
We need to rewrite it in a way how TGScrollBar does it.
Be done.

Thanks. Regards. Valeriy

fix in CVS