[futurebasic] Re: [FB] Scrolling a window full of buttons and edit fields

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2006 : Group Archive : Group : All Groups

From: Joe Lertola <joefb@...>
Date: Sun, 2 Apr 2006 15:10:48 -0400
Brian,

Thanks for your help. I missed this example which seems to do exactly 
what I want. Oddly there is a compile long statement at the top of this 
example which should prevent the example from running with the 
Appearance option checked in the FB Command menu. It does compile and 
run fine but the fact that there is an explicit statement that it does 
not work with the Appearance option makes me nervous to incorporate it 
into my program.

-Joe


On Apr 1, 2006, at 11:03 PM, Brian Stevens wrote:

> The example on the CD found at the path shown might help.
>
> The basic flaw in the code posted is ALL the edit fields are redrawn 
> every time the scroll button is moved by the user.  This is causing 
> the annoying flashing. The CD example shows a better way of drawing 
> the edit fields once and scrolling with the scroll button. The edit 
> fields are never redrawn.
>
> /Examples/Ref Manual Examples/E/Edit Field Scrolling.Bas
>
> Brian S.
>
>
> On Apr 1, 2006, at 6:59 PM, Joe Lertola wrote:
>
>> Hi all,
>>
>> I have been struggling with this all afternoon. I am trying to scroll 
>> a window full of buttons and edit fields. I would love to have the 
>> contents of the window scroll smoothly as the scroll button is moved. 
>> Failing that I would be satisfied if the contents of the window 
>> remained static until the button was released and then have the 
>> contents redrawn properly. I haven't even been able to get that to 
>> work in a satisfying way. I am getting a lot of flashing and 
>> partially drawn buttons. The example below is the best I have been 
>> able to do so far. Any help would be greatly appreciated.
>>
>> -Joe
>>
>>
>> _windHt = 300
>> _areaToScroll = 600
>> _scrlBtn = 1
>> dim xrect as rect
>> dim xThumbPosition% as int
>> dim as int btnId
>> local fn drawSomething(thumb%)
>> dim as rect myRect
>> setrect(myRect, 0, 0,  _windHt, _areaToScroll)
>> color _zWhite
>> 'erase old stuff
>> PAINTRECT(myRect)
>> color _zBlack
>> offsetrect(myRect, 0, -thumb%)
>> insetrect(myRect, 30, 30)
>> framerect(myRect)
>>
>> 'put some stuff i window to scroll
>> setrect(myRect, 40, 40,  260, 60)
>> offsetrect(myRect, 0, -thumb%)
>> btnId = 2
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> BUTTON btnId,_enable,"Test button",@myRect, 3
>> offsetrect(myRect, 0, 25)
>> inc(btnId)
>> EDIT FIELD btnId,"some text text",@myRect, 1,_leftJust
>> end fn
>>
>> '-------------------------------
>> local fn DoDialog
>> dim as long   evnt, id, thumbPosition
>> evnt  = dialog ( 0 )
>> id    = dialog ( evnt )
>> select evnt
>> case _btnClick
>> select id
>> case _scrlBtn
>> xThumbPosition% = Button(id)
>> fn drawSomething(xThumbPosition%)
>> end select
>> CASE _wndRefresh
>> fn drawSomething(xThumbPosition%)
>> end select
>> end fn
>> '-------------------------------
>>
>> setrect(xrect, 0, 0,  _windHt, _windHt)
>>
>> WINDOW 1,"test",@xrect, _doc
>>
>> Scroll Button _scrlBtn,0,0,300,75,,_scrollVert
>>
>> on dialog fn DoDialog
>>
>> do
>> HANDLEEVENTS
>> until gFBQuit
>>
>> --
>>
>
> --
>
>
>