Manipulate Browse Scrollbars?

Manipulate Browse Scrollbars?

Postby Bill Simmeth » Thu Jun 08, 2006 1: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
Bill Simmeth
 
Posts: 42
Joined: Wed Oct 26, 2005 1:20 pm
Location: Marshall, Virginia, USA

Postby Antonio Linares » Fri Jun 09, 2006 4:54 am

Bill,

You may remove the horizontal scrollbar this way:
Code: Select all  Expand view
   oBrw:oHScroll:SetRange( 0, 0 )
   oBrw:oHScroll = nil

You may show the vertical scrollbar this way:
Code: Select all  Expand view
   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
User avatar
Antonio Linares
Site Admin
 
Posts: 41461
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Fri Jun 09, 2006 8: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):

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8408
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Bill Simmeth » Fri Jun 09, 2006 1: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
Bill Simmeth
 
Posts: 42
Joined: Wed Oct 26, 2005 1:20 pm
Location: Marshall, Virginia, USA

Postby Antonio Linares » Fri Jun 09, 2006 9:18 pm

Bill,

Very good :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41461
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 2 guests