It is currently Sat Apr 29, 2017 4:14 am



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 38 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 2:50 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
Hi,

I think I found a solution.
minimum-scale, user-scalable and shrink-to-fit (I understood this is only for Safari) do not seem to be working, but initial-scale and maximum-scale seem to work.

The trick is this:
Code:
GW_SET_VIEWPORT(page, "width=device-width initial-scale=X maximum-scale=1.0")

where the value for X should be set between 0.1 and 1.0, chosen according to the device screen size the app is running on (I updated my little function so that commas are not needed, aligning it to GW Lib parameter style ;) )
In case of x < 1.0 then, in order to see the whole page width, the app user must decide if to scroll left and right or to pinch out on the page (I didn't find a way to show the whole width of the page right from the initial rendering, but at least if the X value is chosen carefully for the target screen, then the controls inside the page get never overlapped or garbled, and the user by scrolling horizontally or pinch-zooming can see everything).

Try the code below. On my 8'' tablet a value of 0.7 for X is OK to show the text and all the 5 buttons. If you use a phone most likely you have to change the value to 0.5 or 0.4.
It seems the GW_SET_VIEWPORT() function (at the end of the code below) could be useful after all.... maybe could it find its way into GW Lib 4.4? (I think some additional testing is needed... Gilles?)

Cheers,
Luca

Code:
GOSUB gw_init

page = GW_NEW_PAGE()
GW_SET_VIEWPORT(page, "width=device-width initial-scale=0.7 maximum-scale=1.0")
GW_SHELF_OPEN(page)
GW_SHELF_NEWCELL(page) : GW_ADD_TEXT(page, "Text.....1")
GW_SHELF_NEWCELL(page) : GW_ADD_BUTTON(page, "Button.....1", "1")
GW_SHELF_NEWCELL(page) : GW_ADD_BUTTON(page, "Button.....2", "2")
GW_SHELF_NEWCELL(page) : GW_ADD_BUTTON(page, "Button.....3", "3")
GW_SHELF_NEWCELL(page) : GW_ADD_BUTTON(page, "Button.....4", "4")
GW_SHELF_NEWCELL(page) : GW_ADD_BUTTON(page, "Button.....5", "5")
GW_SHELF_CLOSE(page)
GW_RENDER(page)
GW_WAIT_ACTION$()
END

gw_init:
GW_SILENT_LOAD = 1
INCLUDE "GW.bas"
FN.DEF GW_SET_VIEWPORT(page, new_viewport$)
  IF !IS_IN(",", new_viewport$) THEN new_viewport$ = REPLACE$(new_viewport$, " ", ", ")
  page$ = GW_PAGE$(page)
  left = IS_IN("content='", page$) + 8
  right = LEN(page$) - IS_IN("'><style>", page$) + 1
  new_page$ = LEFT$(page$, left) + new_viewport$ + RIGHT$(page$, right)
  LIST.REPLACE 1, ABS(page), new_page$
FN.END
RETURN


Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 4:43 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 818
Location: France
luca_italy wrote:
Try each of these just after GW_NEW_PAGE() and see if anything changes:

Code:
page = GW_NEW_PAGE()

GW_SET_VIEWPORT(page,"width=device-width, shrink-to-fit=yes")
GW_SET_VIEWPORT(page,"width=device-width, shrink-to-fit=yes, user-scalable=no")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=1.0, shrink-to-fit=yes")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=1.0, shrink-to-fit=yes, user-scalable=no")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=0.5")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=0.5, user-scalable=no")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=0.1")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=0.1, user-scalable=no")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=2.0")
GW_SET_VIEWPORT(page,"width=device-width, initial-scale=2.0, user-scalable=no")


Luca


Hello guys,
absolutely no changes with any of Luca's strings proposed !!!

Grrr !

Cheers

Gilles

EDIT: oops! I had not seen your last post Luca !!! I test immediately :) :)

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 4:49 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5487
Location: Paris, France
Works on my phone, but you need to manually pinch to zoom out.

If you find a way to render the page directly in the "initial-scale" without user action, I'll put it in GW 4.4 ;)

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 5:15 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 818
Location: France
Unfortunately no changes Luca :oops: :oops:

In any case with my code :
Attachment:
DataPass.zip [6.51 KiB]
Downloaded 56 times

on my Samsung A3 (1280x720)

Maybe I do someting wrong for the test?

Gilles

PS: are you sure that to modify a function's parameter ( in this case it's new_viewport$ ) inside the function itself without using '&' somewhere works correctly Luca ?

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Last edited by Cassiope34 on Thu Dec 01, 2016 5:21 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 5:20 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5487
Location: Paris, France
Gilles, avec la démo de Luca il faut manuellement pincer l'écran pour dézoomer ;)
Ca marche sur mon téléphone et cela correspond à ce que je disais un peu + haut: l'écran est "adapté" au téléphone mais aux forceps: on voit qu'il s'agit d'une version tablette virtuellement mise à l'échelle pour tenir sur un écran + petit...

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 5:25 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 818
Location: France
mougino wrote:
on voit qu'il s'agit d'une version tablette virtuellement mise à l'échelle pour tenir sur un écran + petit...

Nicolas

Faut voir mais c'est peut-être moins grave qu'actuellement :oops:
Ceci dit, actuellement je pourrais imposer d'utiliser l'APK en mode paysage !!! mais ça ne me plait pas :evil:

Effectivement je n'ai pas essayé la demo de Luca mais directement dans mon code...
Même en 'pinçant' pour dé-zoomer ça ne fonctionne pas plus, ni en changeant la valeur de X !!!
Je vais essayer la demo de Luca mais il me restera quand même à faire fonctionner tout ça dans mon code !!!

Cheers

Gilles

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Last edited by Cassiope34 on Thu Dec 01, 2016 5:28 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 5:28 am 
Offline
User avatar

Joined: Tue Jan 03, 2012 9:31 am
Posts: 5487
Location: Paris, France
Cassiope34 wrote:
PS: are you sure that to modify a function's parameter ( in this case it's new_viewport$ ) inside the function itself without using '&' somewhere works correctly Luca ?

Yes it works correctly but the new_viewport$ will not retain the changes.

This is called passing parameters by copy: a copy of 'new_viewport$' variable is created in the function namespace. When leaving the function, this copy is recycled (no impact on original 'new_viewport$').

As opposed to passing parameters by reference (&new_viewport$) where it passes the address to the variable in the main namespace and any operation in the function will change it also outside the function.

Nicolas

_________________
- Creator of the Android BASIC! Compiler


Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 5:31 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 818
Location: France
Ah ok Nicolas I understand now :mrgreen: :geek:

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 5:50 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
Bonjour Gilles,

Pour essayer avec ton code tu dois utiliser
GW_SET_VIEWPORT(page, "width=device-width initial-scale=0.4 maximum-scale=1.0")
immédiatement après chaque fois que tu crées une nouvelle page.
Et rappelle-toi d'utiliser toujours la même variable que tu as utilisée dans
page = GW_NEW_PAGE()

Luca


Top
 Profile  
 
 Post subject: Re: No scale exists with GW ?
Unread postPosted: Thu Dec 01, 2016 6:00 am 
Offline

Joined: Sat Mar 02, 2013 11:04 am
Posts: 818
Location: France
Salut Luca,
très heureux de voir que tu parles très bien francais :)

Oui oui j'ai respecté tout bien comme il faut crois moi ! mais seulement sur la page qui me pose ce problème d'affichage c'est à dire la page 'lvp' dans mon code : celle que je montre dans mon premier post...

Mais comme le dit Nicolas, ta super fonction ne permet quand même pas d'afficher une page dans une dimension initiale voulue : elle l'affiche comme avant mais simplement elle deviendra 'zoomable' avec un maximum défini. Ce n'est pas le but recherché malheureusement !

Amicalement,

Gilles

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 38 posts ]  Go to page Previous  1, 2, 3, 4  Next


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred