Recent

Author Topic: Suggestion 3 new functions for "jForms"  (Read 3291 times)

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Suggestion 3 new functions for "jForms"
« on: October 23, 2018, 11:32:21 am »
"getScreenWidth" and "getScreenHeight" Sometimes you need to know the exact screen size to make adjustments.

"getSystemVersionString" shows us the android version in text format for example: '6.0' instead of 23 which would be the same "getSystemVersion"

Code: Java  [Select][+][-]
  1.     public int getScreenWidth( ){
  2.         return this.controls.activity.getResources().getDisplayMetrics().widthPixels;        
  3.     }
  4.    
  5.     public int getScreenHeight( ){      
  6.         return this.controls.activity.getResources().getDisplayMetrics().heightPixels;
  7.     }
  8.    
  9.     public String getSystemVersionString(){
  10.         return android.os.Build.VERSION.RELEASE;
  11.     }

guest58172

  • Guest
Re: Suggestion 3 new functions for "jForms"
« Reply #1 on: October 23, 2018, 04:07:52 pm »
look at the dot completion proposals for `screen.` There's already all what you need.

ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: Suggestion 3 new functions for "jForms"
« Reply #2 on: October 23, 2018, 04:11:19 pm »
look at the dot completion proposals for `screen.` There's already all what you need.
Where can I look?

guest58172

  • Guest
Re: Suggestion 3 new functions for "jForms"
« Reply #3 on: October 23, 2018, 06:06:19 pm »
`Forms` must be in the `uses`. Then `screen.width`, `screen.height` etc. Try to learn and explore the LCL before suggesting next  time. Lazarus is over 10 years old so you can imagine that tons of stuff are already there.


ADiV

  • Jr. Member
  • **
  • Posts: 90
    • ADiV Software
Re: Suggestion 3 new functions for "jForms"
« Reply #4 on: October 23, 2018, 06:43:27 pm »
`Forms` must be in the `uses`. Then `screen.width`, `screen.height` etc. Try to learn and explore the LCL before suggesting next  time. Lazarus is over 10 years old so you can imagine that tons of stuff are already there.

What you told me is the first thing I tried, but Android does not return the real value of the screen, I always got the same resolution of 320x648 on 720x1280 screens and 540x960 screens. Just get the real value using the functions described above, try it and tell me.

Greetings.

Ps. I've been programming in Delphi for more than 20 years.
« Last Edit: October 23, 2018, 08:57:50 pm by TR3E »

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Suggestion 3 new functions for "jForms"
« Reply #5 on: October 23, 2018, 07:39:08 pm »

Quote
Forms must be in the `uses`.....

some misunderstanding here: LAMW "jForm" ... not LCL "Form" compatible.
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

guest58172

  • Guest
Re: Suggestion 3 new functions for "jForms"
« Reply #6 on: October 23, 2018, 10:26:16 pm »
Indeed i've missed the fact that OP's posted in the Android subforum.

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: Suggestion 3 new functions for "jForms"
« Reply #7 on: October 23, 2018, 11:59:26 pm »

Suggestions Commited!!

Thank you!
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

 

TinyPortal © 2005-2018