Scrolling

This forum is for eXpress++ general support.
Post Reply
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Scrolling

#1 Post by c-tec »

Hello,
I have some problems to understand VSCROLL and HSCROLL of DCSTATIC. If I scroll down in my sample, the static scrolls over the button on the top of the dialog. The scrollarea should only be in the area of oStatic2.
I also would like to make the scroll buttons larger. I think I can go throug the getlist and change the size of the object, but is there an easier way to do this ?
regards
Rudolf

Code: Select all

#INCLUDE "dcdialog.CH"

function Main()
******************************************************************
local getlist := {},x,oStatic1,oStatic2
@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 500,700  OBJECT oStatic1 PIXEL  RESIZE DCGUI_RESIZE_AUTORESIZE_SCALEFONT
@ 1,1 DCPUSHBUTTONXP size 500,40 caption "buttons" PIXEL PARENT oStatic1
@ 42,0 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 500,700-42 OBJECT oStatic2 PARENT oStatic1 PIXEL RESIZE DCGUI_RESIZE_AUTORESIZE_SCALEFONT;
                    VSCROLL oStatic1 RANGE 0,500 INCREMENT 10 ;
                    HSCROLL oStatic1 RANGE 0,500 INCREMENT 10

for x := 1 to 100 step 20
     @ x,20 dcsay "Test" saysize 0 parent oStatic2 PIXEL

next x
DCREAD GUI TITLE "Test" FIT EVAL {|o|SetAppWindow(o)}
return .t.

PROC appsys
return
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Scrolling

#2 Post by rdonnay »

If you want more control, I suggest using DCSTATIC and DCSCROLLBAR commands.
The eXpress train is coming - and it has more cars.

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Scrolling

#3 Post by c-tec »

Hello Roger,
thank you, got it working so far. But here I have also the problem that oStatic2 scrolls over the button on the top of the dialog.
How can I make the scroller button higher ?
regards
Rudolf

Code: Select all

#INCLUDE "dcdialog.CH"
#INCLUDE "xbp.CH"
#INCLUDE "appevent.CH"



function Main()
******************************************************************
local getlist := {},x,oStatic1,oStatic2,lTest := .t.
local aStatic  := {}
local nVertOffset := 0, nHorizOffset := 0, nVert, nHoriz, i, j, oVertScroll, oHorizScroll, GetOptions


@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 500,700  OBJECT oStatic1 PIXEL  RESIZE DCGUI_RESIZE_AUTORESIZE_SCALEFONT
@ 1,1 DCPUSHBUTTONXP size 500,40 caption "buttons" PIXEL PARENT oStatic1
@ 42,0 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 500,700-42 OBJECT oStatic2 PARENT oStatic1 PIXEL RESIZE DCGUI_RESIZE_AUTORESIZE_SCALEFONT
@ 0,500 DCSCROLLBAR DATA nVertOffset  SIZE 50,700-42 TYPE XBPSCROLL_VERTICAL   RANGE 0,2000 AUTOTRACK OBJECT oVertScroll  SCROLL { |mp1,x,o| scroller(mp1,o,oStatic1,oStatic2,nVert,@nVertOffset,2) } PIXEL


for x := 1 to 100 step 20
     @ x,20 dcsay "Test" saysize 0 parent oStatic2 PIXEL
next x

DCREAD GUI TITLE "Test" FIT  EVAL {|o|nVert:=oStatic2:currentPos()[2], ;
            nHoriz:=oStatic2:currentPos()[1], ;
            o:reSize := {|a,b,x|scroll_resize(a,b,x,oStatic1,oStatic2,oVertScroll, @lStartUp )} }


return .t.


PROC appsys
return

STATIC FUNCTION scroll_resize( aOldSize, aNewSize, oDlg, oStatic1, oStatic2,oVertScroll, lStartUp )
******************************************************************
LOCAL nWidth  := aNewSize[1] - aOldSize[1]
LOCAL nHeight := aNewSize[2] - aOldSize[2]
IF !empty(lStartUp)
  lStartUp := .f.
  RETURN nil
ENDIF
oStatic1:setSize( {oStatic1:currentSize()[1]+nWidth,oStatic1:currentSize()[2]+nHeight} )
oStatic2:setSize( {oStatic2:currentSize()[1]+nWidth,oStatic2:currentSize()[2]+nHeight} )
oVertScroll:setSize( {oVertScroll:currentSize()[1],oVertScroll:currentSize()[2]+nHeight} )
oVertScroll:setPos( {oVertScroll:currentPos()[1]+nWidth,oVertScroll:currentPos()[2]} )

RETURN nil



STATIC FUNCTION scroller( a, oScroll, oStatic1, oStatic2, nStart, nOffset, nScroll )
******************************************************************
LOCAL nEvent, mp1, mp2, oXbp

nEvent := DC_NextAppEvent(@mp1,@mp2,@oXbp)
IF nEvent = xbeSB_Scroll
  RETURN nil
ENDIF

IF a[2] == XBPSB_NEXTPAGE
  nOffset += oStatic1:currentSize()[nScroll]
  oScroll:setData()
ELSEIF a[2] == XBPSB_PREVPAGE
  nOffset -= oStatic1:currentSize()[nScroll]
  oScroll:setData()
ELSE
  nOffset := a[1]
ENDIF
altd()
IF nScroll = 2
  oStatic2:setPos({oStatic2:currentPos()[1],nStart+nOffset})
ELSE
  oStatic2:setPos({nStart-nOffset,oStatic2:currentPos()[2]})
ENDIF

RETURN nil

Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: Scrolling

#4 Post by Auge_Ohr »

hi,

your PushButton is on same Parent oStatic1 which Size > ::drawingArea ( which give you vertical Scrollbar )

you have to put your Pushbutton on oDlg and than "resize" o:drawingArea

Code: Select all

   aTmp := oDlg:DrawingArea:Currentsize()
   // on bottom
   oStatbar := Statbar() :new( oDlg ) // oDlg !!!
   oStatbar:Caption := "myStatbar"
   oStatbar:create(,, { 0, 0 }, { aTmp[ 1 ], nHigh }, aPres )
   // new ::drawingArea Pos/Size
   oDlg:DrawingArea:SetPosAndSize( { 0, nHigh }, { aTmp[ 1 ], aTmp[ 2 ] - nHigh } )
greetings by OHR
Jimmy

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: Scrolling

#5 Post by c-tec »

Hello Jimmy,
thank you, this is a workaround I think. But how put I the buttons and other things thon on this static area. In Rogers scroll sample there are always 3 statics involved, I wanted to avoid this and do this with 2 statics and the SCROLLBAR option of DCSTATIC. The code to put a simple scrollable area on a static is rather complicated. So if I need this for more different dialogs, it becomes complicated.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

Post Reply