Board index » cppbuilder » ListView1: How to get hide the horizontal scrollbar?
Jeff
CBuilder Developer |
Jeff
CBuilder Developer |
ListView1: How to get hide the horizontal scrollbar?2007-01-06 06:35:51 AM cppbuilder46 How to get hide the horizontal scrollbar in ListView1? Is there a ListView1->HScrollBar->Visible = false; |
Remy Lebeau (TeamB)
CBuilder Developer |
2007-01-06 07:20:55 AM
Re:ListView1: How to get hide the horizontal scrollbar?
"Jeff" < XXXX@XXXXX.COM >wrote in message
QuoteHow to get hide the horizontal scrollbar in ListView1? Not that it does not work for most view styles, though. Alternatively, try using Get/SetWindowLong() to remove the WS_HSCROLL style, ie: LONG style = GetWindowLong(ListView1->Handle, GWL_STYLE); if( (style & WS_HSCROLL) != 0 ) SetWindowLong(ListView1->Handle, GWL_STYLE, style & ~WS_HSCROLL); Or to specify the LVS_NOSCROLL style, ie: LONG style = GetWindowLong(ListView1->Handle, GWL_STYLE); SetWindowLong(ListView1->Handle, GWL_STYLE, style | LVS_NOSCROLL); QuoteIs there a ListView1->HScrollBar->Visible = false; |
JD
CBuilder Developer |
2007-01-06 07:21:56 AM
Re:ListView1: How to get hide the horizontal scrollbar?
"Jeff" < XXXX@XXXXX.COM >wrote:
Quote
the control and overriding it's WndProc method or subclass the control and add a message map (message handler) for WM_NCCALCSIZE. For example, to subclass the WindowProc: private: // User declarations TWndMethod OldWndProc; void __fastcall NewWndProc( TMessage &Message ); public: // User declarations __fastcall ~TForm1(); //------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { OldWndProc = ListView1->WindowProc; ListView1->WindowProc = NewWndProc; } //------------------------------------------------------------- __fastcall TForm1::~TForm1() { ListView1->WindowProc = OldWndProc; } //------------------------------------------------------------- void __fastcall TForm1::NewWndProc( TMessage &Message ) { if( Message.Msg == WM_NCCALCSIZE ) { LONG Style = ::GetWindowLong( ListView1->Handle, GWL_STYLE ); if( Style & WS_HSCROLL ) { ::SetWindowLong( ListView1->Handle, GWL_STYLE, Style & ~WS_HSCROLL ); } } OldWndProc( Message ); } //------------------------------------------------------------- QuoteIs there a ListView1->HScrollBar->Visible = false; {smallsort} |
Jeff
CBuilder Developer |
2007-01-06 08:00:10 AM
Re:ListView1: How to get hide the horizontal scrollbar?
Thanks Gambit and JD. Both work.
Gambit, where do you place ShowScrollBar(ListView1->Handle, SB_HORZ, FALSE); in your code? |
Remy Lebeau (TeamB)
CBuilder Developer |
2007-01-06 09:04:09 AM
Re:ListView1: How to get hide the horizontal scrollbar?
"Jeff" < XXXX@XXXXX.COM >wrote in message
QuoteGambit, where do you place |