Home » Community » Newbie corner » hiding the vertical scrollbar of LineEdit Ctrl
hiding the vertical scrollbar of LineEdit Ctrl [message #38044] |
Thu, 29 November 2012 08:59 |
navi
Messages: 107 Registered: February 2012 Location: Sydney, Australia
|
Experienced Member |
|
|
Hi All,
Just wondering, Is there a way to hide the vertical scrollbar of LineEdit Ctrl? I have two LineEdit Ctrl displaying almost similar text with same number of lines and I only want one of them to show the vertical scrollbar and they both can be scrolled together with only one showing the bar.
I have extend the LineEdit Ctrl as follwing to get the synchronize scrolling. Now I just need a way to hide one of the vertical scrollbar now.
there is a function LineEdit::NoHorzScrollbar() but could not find a similar function for Vertical Scrollbar. I also skim through the LineEdit Class but the Scrolling mechanism looks not that easy to understand. It uses the 'Scroller' Class that I could not find any documentation for.
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
class LineEditExtended : public LineEdit{
public:
virtual void NewScrollPos(){ WhenScrollChange();}
Callback WhenScrollChange;
};
class MainWindowDlg : public TopWindow {
typedef MainWindowDlg CLASSNAME;
public:
MainWindowDlg(){
SetRect(0,0,600,400);
tx1.VSizePos(10,10).LeftPos(10,290);
tx2.VSizePos(10,10).RightPos(10, 290);
this<<tx1<<tx2;
String tmp;
for(int i=0; i<100; i++) tmp<<i<<"\n";
tx1.Set(tmp);
tx2.Set(tmp);
tx2.WhenScrollChange=THISBACK(tx1Totx2SyncScrol);
tx1.WhenScrollChange=THISBACK(tx2Totx1SyncScrol);
}
private:
void tx2Totx1SyncScrol(){
tx2.SetScrollPos(tx1.GetScrollPos());
}
void tx1Totx2SyncScrol(){
tx1.SetScrollPos(tx2.GetScrollPos());
}
LineEditExtended tx1, tx2;
};
GUI_APP_MAIN
{
MainWindowDlg w;
w.Run();
}
Thank & Regards
Navi
-
Attachment: main.cpp
(Size: 1.10KB, Downloaded 207 times)
|
|
|
Goto Forum:
Current Time: Wed May 08 00:31:46 CEST 2024
Total time taken to generate the page: 0.02945 seconds
|