U++ framework
Do not panic. Ask here before giving up.

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 Go to previous message
navi is currently offline  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 407 times)
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: moveable question
Next Topic: Changing EditFields from header files
Goto Forum:
  


Current Time: Mon Nov 02 11:40:51 GMT+1 2026

Total time taken to generate the page: 0.96723 seconds