Page 1 of 1
Width of vertical scrollbar in browse
Posted: Tue Nov 19, 2013 8:10 am
by skiman
Hi,
What is the easiest way to change the width of the vertical scrollbar of a dcbrowse? I need a wider scrollbar to use on a touchscreen.
Re: Width of vertical scrollbar in browse
Posted: Tue Nov 19, 2013 8:42 am
by rdonnay
Chris -
I developed a touch-screen application for a customer.
In my earlier versions, I enlarged the browse scrollbars (as you requested).
We determined that scrollbars do not work well on touch screen apps.
I came up with a solution that I believe works much better.
Look at the below screen.

- touchscreen.jpg (89.98 KiB) Viewed 9742 times
Re: Width of vertical scrollbar in browse
Posted: Tue Nov 19, 2013 9:19 am
by skiman
Hi Roger,
I also have 4 buttons created with pageup/up/down/pagedown functions. But I thought that a scrollbar would be better.
Anyway, I have problems to define the exact position of my buttons. I placed them just at the right of my browse, but it seems as I can't get the correct position. I don't know if it is because I use the FIT clause of the browse. Using dcgui_col isn't working.
Re: Width of vertical scrollbar in browse
Posted: Tue Nov 19, 2013 9:21 am
by skiman
Hi,
obrowse:drawingarea:currentSize()[1] and obrowse:currentSize()[1] gives me an error.
Re: Width of vertical scrollbar in browse
Posted: Tue Nov 19, 2013 9:28 am
by skiman
Hi,
Using @ 0, 0 dcpushbuttonxp relative oBrowse ... isn't working. The button is at the left down corner of the browse?
Re: Width of vertical scrollbar in browse
Posted: Tue Nov 19, 2013 10:58 am
by rdonnay
I will write a small sample program that enlarges the scrollbars and also adds a set of buttons.
You can see a sample program for enlarging scrollbars in the eXpress++ samples.
Look at \exp19\samples\touchscr\scrollbar.prg
Code: Select all
#INCLUDE "dcdialog.CH"
PROC appsys
RETURN
* ------------
FUNCTION Main()
LOCAL GetList[0], GetOptions, oBrowse, aDir
aDir := Directory()
@ 5,10 DCBROWSE oBrowse DATA aDir SIZE 30,10 PRESENTATION DC_BrowPres() ;
RESIZE DCGUI_RESIZE_RESIZEONLY
DCBROWSECOL ELEMENT 1 HEADER '1' WIDTH 10 PARENT oBrowse
DCBROWSECOL ELEMENT 2 HEADER '2' WIDTH 10 PARENT oBrowse
DCBROWSECOL ELEMENT 3 HEADER '3' WIDTH 10 PARENT oBrowse
@ 16,10 DCPUSHBUTTON CAPTION 'Adjust ScrollBar' SIZE 20,2 ;
ACTION {||AdjustScrollBar(oBrowse)}
DCGETOPTIONS RESIZE
DCREAD GUI ;
OPTIONS GetOptions ;
EVAL {||AdjustScrollBar( oBrowse) }
RETURN nil
* ------------
FUNCTION AdjustScrollBar( oBrowse)
LOCAL i, aChildList
aChildList := oBrowse:childList()
oBrowse:xbpstatic:setSize({oBrowse:xbpstatic:currentSize()[1]+15, ;
oBrowse:xbpstatic:currentSize()[2]+15})
FOR i := 1 TO Len(aChildList)
IF aChildList[i]:isDerivedFrom('XbpScrollBar') .AND. ;
aChildList[i]:type == XBPSCROLL_VERTICAL
aChildList[i]:setSize({30,aChildList[i]:currentSize()[2]})
aChildList[i]:setPos({aChildList[i]:currentPos()[1],30})
ELSEIF aChildList[i]:isDerivedFrom('XbpScrollBar') .AND. ;
aChildList[i]:type == XBPSCROLL_HORIZONTAL
aChildList[i]:setSize({aChildList[i]:currentSize()[1],30})
ENDIF
NEXT
aChildList := oBrowse:xbpstatic:childList()
FOR i := 1 TO Len(aChildList)
IF !aChildList[i]:isDerivedFrom('XbpScrollBar')
aChildList[i]:setPos({aChildList[i]:currentPos()[1], ;
aChildList[i]:currentPos()[2]+15})
ENDIF
NEXT
RETURN nil
Re: Width of vertical scrollbar in browse
Posted: Wed Nov 20, 2013 12:59 am
by skiman
Hi Roger,
Thanks for the sample.