GLBasic forum

Main forum => GLBasic - en => Topic started by: aroldo on 2013-Apr-22

Title: Screen Scrolling
Post by: aroldo on 2013-Apr-22
GLB Community,

I am developing and app for mobile devices that retrieves text and information from the web and then displays to the user.
Since the information will not fit the screen the user need to scroll up or down touching the screen of the device.
On the screen I will have images and text.

Does any one knows a sample or GLB command that can help me manage the screen scrolling?
Title: Re: Screen Scrolling
Post by: erico on 2013-Apr-23
I´m not sure if I grasp what you mean, but you can display and print on a huge vertical image and move its y position.
You must be looking for something more complex maybe?
Title: Re: Screen Scrolling
Post by: aroldo on 2013-Apr-23
If I use a native code for iOS or Palm, if I print text line or an image that is taller the the device height the OS will enable the scrolling feature.
I GLB I have to simulate that, using the mouse y position and the extended printed area.
Title: Re: Screen Scrolling
Post by: CW on 2013-Apr-23
Traditional methods of smooth scrolling would be far too slow in GLbasic because you would have to rely on our old friend, the SetPixel command across the entire screen. (If you can be happy with pure text and do not mind some major jerkiness in the scrolling, than the simple GLbasic Print String$,x,y command could handle that.) For smooth scrolling, the task may be doable using inline C code; but first I would try Enrico's suggestion, of mapping the entire page (with pictures) to a virtual screen in memory, doing a GRABSPRITE of the virtual screen to produce a sprite which is far larger than the actual screen, and then sliding the sprite around for display to simulate scrolling. I honestly don't know that this approach would work, but it seems reasonable, and it would be fun to try.
-CW
Title: Re: Screen Scrolling
Post by: erico on 2013-Apr-23
Enrico Morricone? :D :D

You may wanna try USESCREEN instead of GRABSPRITE just to be sure on mobiles.
How big would those texts+pics be? Maybe divide them into sets of sprites?
Title: Re: Screen Scrolling
Post by: CW on 2013-Apr-23
OOps! Sorry about that Erico. I don't know where that n came from.  :-[
-CnW
Title: Re: Screen Scrolling
Post by: aroldo on 2013-Apr-23
Enrico,

The screen height size will vary, in some devices 640, 960, 1024, 2048.
Every time the uses touches the screen up to see if the messages that are is beyond the screen height I will have to scroll the entire screen.

Using in Line C code is an option but I will have to do a function for each device I plan to support.
Title: Re: Screen Scrolling
Post by: hardyx on 2013-Apr-23
You can make your own code to draw text in a memory screen (USESCREEN) and draw using an offset. Or you can use DDGui that is more easy and use a multiline Text or List control wich supports scroll. If you want to show only text, it's not complex to draw lines beggining with the index you want to scroll.
Title: Re: Screen Scrolling
Post by: erico on 2013-Apr-23
At least Enrico is better then Rico Suave (like people used to call me in the US... :P)

Arnoldo, I didn´t mean the device screen resolution. I meant the amount of text you need to scroll, would it happen to be like a great amount of text? Let´s say enough you would need 10 screens combined (like 720x12800 on a note II)? That is if you choose the USESCREEN method better described by Hardnyx, I believe you would have to brake it down into sets of screen so not to force the mobile too much. Or create the screen kind of on-the-fly and work with a couple.

Using USESCREEN you are not going to be able to copy/paste the text, you don´t plan to have that feature right?

Maybe DDGnui is a better option, but I never tried it.
Title: Re: Screen Scrolling
Post by: kanonet on 2013-Apr-23
Why not just have a look in various GUI code to see how they did scrolling of text fields? E.g. have a look at DDgui.