Page 1 of 2
Cannot show scrollbars in androi
Posted: Mon May 29, 2017 4:24 pm
by nicalejo
Once deployed in an android device I cannot show the scrollbars, perfectly shown as a web app in PC, so they are totally useless. My mistake? Bug?
THX
Re: Cannot show scrollbars in androi
Posted: Sun Jun 04, 2017 9:27 am
by nicalejo
The sample code from documentation
Code: Select all
Procedure GadgetEvent()
Debug "Button " + EventGadget() + " pressed!"
EndProcedure
If OpenWindow(0, 0, 0, 305, 140, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScrollAreaGadget(0, 10, 10, 290,120, 375, 155, 30)
ButtonGadget (1, 10, 10, 230, 30,"Button 1")
ButtonGadget (2, 50, 50, 230, 30,"Button 2")
ButtonGadget (3, 90, 90, 230, 30,"Button 3")
TextGadget (4,130,130, 230, 20,"This is the content of a ScrollAreaGadget!",#PB_Text_Right)
CloseGadgetList()
BindEvent(#PB_Event_Gadget, @GadgetEvent())
EndIf
simply does not show the scrollbars.
If I click on a Gadget, the scrollbar moves itself to fit the gadget in the visible area but I cannot move the area touching the sceen. Is this the expected behaviour? Of course deploying on an android device
Re: Cannot show scrollbars in androi
Posted: Mon Jun 05, 2017 2:15 pm
by IdeasVacuum
Hmm, I can't remember seeing an Android app with scrollbars - you can scroll a page or area within a page by 'swiping' it, no scrollbars required?
Re: Cannot show scrollbars in androi
Posted: Tue Jun 06, 2017 8:23 am
by nicalejo
I even cannot show the last created gadget (TextGadget "This is the content of a ScrollAreaGadget!"). Is there a special gesture to scroll? Can anyone try the apk generated in an android phone and tell me if is the correct behaviour?
THX
Re: Cannot show scrollbars in androi
Posted: Tue Jun 06, 2017 2:39 pm
by IdeasVacuum
So, tried it on my phone - the window is rendered rather small (which might not help the scroll issue). In my view, the app should take up the whole screen, as the other apps do.
Anyway, my result is the same as yours - scroll not working at all, no scroll bars displayed (if they should be).
I chose 'Automatically upload on USB connected device' - this means sharing the screen with the debug window, which might be significant. Also makes for a large app!
SB 2.00 x86 jdk 1.8.0_131 Android 4.4.4 Lenovo A816
Re: Cannot show scrollbars in androi
Posted: Wed Jun 07, 2017 1:11 am
by IdeasVacuum
So, created an apk to get away from the debug 'mode', in the hope that the app would then be full screen (and scroll!).
The apk file size is 24.4mb, which seems rather large.
Also, apparently the app can:
view network connections
view Wi-Fi connections
has full network access
I don't think it needs any of these so it is a pity if they are auto-included, especially since these are security sensitive.
Unfortunately, the app will not install, I don't know why - it passes a security check/virus check, then tries to install, but fails after approx 30secs.
Edit: Download the file here:
ScrollTest.apk
Re: Cannot show scrollbars in androi
Posted: Wed Jun 07, 2017 4:34 pm
by nicalejo
You have to enable debug the apk in order to install it. Without debugging must be signed before
Re: Cannot show scrollbars in androi
Posted: Wed Jun 07, 2017 10:36 pm
by IdeasVacuum
I was not sure about that because I get a warning on commencing download-install about security:
This type of file can harm your device. Do you want to keep ScrollTest.apk anyway?
Reading this:
Sign Your App Android Studio I am a bit surprised - it seems you do not have to buy a certificate from a 3rd party as you would for Windows applications. However, since we are not using Android Studio to build the app, how do we sign it?
I also came across this:
Android Icon Reference Android icons are separate .png files, which is fine, but SB only asks for one icon file?
Concerning the scroll test, can we suppress the debug window in debug mode?
Re: Cannot show scrollbars in androi
Posted: Wed Jun 07, 2017 11:58 pm
by IdeasVacuum
Working in debug mode! The following code variation actually works, it seems that the ScrollAreaGadget size must be carefully defined?
On app launch, the scrollbars are displayed for a few seconds, then faded out. This would be to let the User know the area is scrollable. When you hold touch on the ScrollArea, the scrollbars are displayed - they seem to serve the purpose of showing relative Window location rather than to be moved by the User. With hold touch, you can scroll as required.
Compiler:
- aeroglass + claro themes (the SB themes look a bit dated, hope it is easy to add others).
- Optimize Javascript output.
Create App:
- Orientation Portrait.
- Fullscreen (doesn't happen)
- Automatically upload on USB connected device
- Enable debugger
Code: Select all
Enumeration
#Win
#Btn1
#Btn2
#Btn3
#BtnExit
#Scroll
#Msg
#Txt
EndEnumeration
Procedure CloseWindowEvent()
;#---------------------------
CloseWindow(EventWindow()) ; Close the specific window
EndProcedure
Procedure MyGadgetEvent()
;#------------------------
SetGadgetText(#Msg, "Button" + Str(EventGadget()) + " pressed!")
EndProcedure
If OpenWindow(#Win, 0, 0, 300, 260, "Window", #PB_Window_BorderLess | #PB_Window_ScreenCentered)
ScrollAreaGadget(#Scroll, 0, 0, 300, 250, 500, 300, 40)
ButtonGadget(#Btn1, 10, 10, 255, 38,"Button 1")
ButtonGadget(#Btn2, 10, 50, 255, 38,"Button 2")
ButtonGadget(#Btn3, 10, 90, 255, 38,"Button 3")
ButtonGadget(#BtnExit, 10, 130, 255, 38,"Exit")
TextGadget(#Msg, 10, 180, 255, 26, "", #PB_Text_Center | #PB_Text_Border)
TextGadget(#Txt, 200, 210, 230, 26, "Scroll to see all of the Text Here", #PB_Text_Right | #PB_Text_Border)
BindEvent(#PB_Event_Gadget, @MyGadgetEvent(), #Win, #Btn1)
BindEvent(#PB_Event_Gadget, @MyGadgetEvent(), #Win, #Btn2)
BindEvent(#PB_Event_Gadget, @MyGadgetEvent(), #Win, #Btn3)
BindEvent(#PB_Event_Gadget, @CloseWindowEvent(), #Win, #BtnExit)
CloseGadgetList()
EndIf
Re: Cannot show scrollbars in androi
Posted: Thu Jun 08, 2017 12:22 pm
by nicalejo
IdeasVacuum, you gave me the key, is just a matter of the attribute #PB_Window_BorderLess, changing the line in my code by
If OpenWindow(0, 0, 0, 305, 140, "ScrollAreaGadget", #PB_Window_SystemMenu | #PB_Window_BorderLess | #PB_Window_ScreenCentered)
it works, It has no sense for me but this is the reason. Your code does not scroll without the PB_Window_BorderLess
THX