BASIC

Author Topic: Screen Scrolling  (Read 1623 times)

Offline aroldo

  • Mr. Polyvector
  • ***
  • Posts: 143
    • View Profile
    • APD Consulting, Inc.
Screen Scrolling
« 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?
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: Screen Scrolling
« Reply #1 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?

Offline aroldo

  • Mr. Polyvector
  • ***
  • Posts: 143
    • View Profile
    • APD Consulting, Inc.
Re: Screen Scrolling
« Reply #2 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.
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

Offline CW

  • Mr. Polyvector
  • ***
  • Posts: 155
    • View Profile
Re: Screen Scrolling
« Reply #3 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
« Last Edit: 2013-Apr-23 by CW »

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: Screen Scrolling
« Reply #4 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?

Offline CW

  • Mr. Polyvector
  • ***
  • Posts: 155
    • View Profile
Re: Screen Scrolling
« Reply #5 on: 2013-Apr-23 »
OOps! Sorry about that Erico. I don't know where that n came from.  :-[
-CnW
« Last Edit: 2013-Apr-23 by CW »

Offline aroldo

  • Mr. Polyvector
  • ***
  • Posts: 143
    • View Profile
    • APD Consulting, Inc.
Re: Screen Scrolling
« Reply #6 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.
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

Offline hardyx

  • Community Developer
  • Dr. Type
  • ******
  • Posts: 491
    • View Profile
Re: Screen Scrolling
« Reply #7 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.
« Last Edit: 2013-Apr-23 by hardyx »

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4218
    • View Profile
    • Portfolio
Re: Screen Scrolling
« Reply #8 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.

Offline kanonet

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1142
    • View Profile
    • My GLBasic code archiv
Re: Screen Scrolling
« Reply #9 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.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64