FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Manipulate Browse Scrollbars?
Posts: 42
Joined: Wed Oct 26, 2005 01:20 PM
Manipulate Browse Scrollbars?
Posted: Thu Jun 08, 2006 01:48 PM

Is it possible to manipulate the presence of the scrollbars on WBrowse? For example, the horizontal scrollbar is always there even if there are no columns hidden. Is there a way to hide the scrollbar when it is not needed?

Similarly, the vertical scrollbar only appears when there are two or more rows on the browser. I would like to display it at all times. (I have a browser used to display an order as it is created. It starts with no records and builds as the user adds to the order. When the scrollbar appears on adding the second record, the screen layout changes which my testers find annoying.)

Thanks in advance.

Bill Simmeth

Merchant Software Corp

Marshall, Virginia USA
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Manipulate Browse Scrollbars?
Posted: Fri Jun 09, 2006 04:54 AM
Bill,

You may remove the horizontal scrollbar this way:
   oBrw:oHScroll:SetRange( 0, 0 )
   oBrw:oHScroll = nil

You may show the vertical scrollbar this way:
   oBrw:oVScroll:SetRange( 1, 2 )

Though it may not properly work in this case, as it does not match the number of shown records.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Manipulate Browse Scrollbars?
Posted: Fri Jun 09, 2006 08:17 AM
Vertical scrollbar can be automatically disabled using the style SIF_DISABLENOSCROLL. This is my changed SetScrollRange() that I'm using in my apps (but this is for FWH):

#pragma BEGINDUMP

#include <WinTen.h>
#include <Windows.h>
#include <HbApi.h>

HB_FUNC( SETSCROLLRANGE )
{
   typedef BOOL ( WINAPI * FN )( HWND, int, LPSCROLLINFO, BOOL );

   FN p = ( FN ) GetProcAddress( GetModuleHandle( "USER32" ), "SetScrollInfo" );

   SCROLLINFO si;

   si.cbSize = sizeof( si );

   if ( hb_parni( 2 ) == SB_VERT && hb_parl( 6 ) )
      si.fMask  = SIF_PAGE | SIF_RANGE | SIF_DISABLENOSCROLL;
   else
      si.fMask  = SIF_PAGE | SIF_RANGE;

   si.nPage = 1;
   si.nMin  = hb_parni( 3 );
   si.nMax  = hb_parni( 4 );

   if( p )
      hb_retl( p( ( HWND ) hb_parnl( 1 ), hb_parni( 2 ), &si, hb_parl( 5 ) ) );
   else
      hb_retl( FALSE );
}

#pragma ENDDUMP


EMG
Posts: 42
Joined: Wed Oct 26, 2005 01:20 PM
Manipulate Browse Scrollbars?
Posted: Fri Jun 09, 2006 01:59 PM

Antonio and Enrico, thank you for your replies and ideas.

I wound up sub-classing TWBrowse and overloaded the NEW and VSetRange methods. In NEW() I added a switch to optionally remove the WS_HSCROLL define from ::nStyle. In VSETRANGE() I set the lower limit to {1,2}. This is working fine for me.

Thanks again.

Bill Simmeth

Merchant Software Corp

Marshall, Virginia USA
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Manipulate Browse Scrollbars?
Posted: Fri Jun 09, 2006 09:18 PM

Bill,

Very good :)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion