Screen Size

Just starting out? Need help? Post your questions and find answers here.
matalog
Posts: 14
Joined: Fri Dec 04, 2020 6:07 am

Screen Size

Post by matalog »

I'm using DPI Aware in Compiling options. Then run this program:

Code: Select all

EnableExplicit
Enumeration
  #Window
  #TextGadget
  #StringGadget
EndEnumeration
CloseDebugOutput()
Procedure StringGadgetEvent()
 ExamineDesktops()
  SetGadgetText(#TextGadget,Str(DesktopWidth(0))+" x "+Str(DesktopHeight(0)))
  
EndProcedure
    OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 400, 600, "", #PB_Window_ScreenCentered|#PB_Window_BorderLess)
        LoadFont(0, "Arial", 16)
TextGadget(#TextGadget, 10, 110, 250, 50,"", #PB_Text_Border)
StringGadget(#StringGadget, 10, 10, 250, 50, "")
SetGadgetFont(#TextGadget, FontID(0))
SetGadgetFont(#StringGadget, FontID(0))
BindGadgetEvent(#StringGadget, @StringGadgetEvent())
SetActiveGadget(#StringGadget)
It says 384 x 854. My phone is set to 1080x2400FHD+.

Am I limited to this resolution using SpiderBasic?
User avatar
Caronte3D
Posts: 187
Joined: Sat Nov 23, 2019 5:21 pm
Location: Some Universe

Re: Screen Size

Post by Caronte3D »

No limitation.
Use and run in the phone:

Code: Select all

SetGadgetText(#TextGadget,Str(DesktopScaledX(DesktopWidth(0)))+" x "+Str(DesktopScaledY(DesktopHeight(0))))
Why do you want pixel values? This way only will show ok on your device and the ones with the same resolution as yours.
Post Reply