web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Help defining static variables

(0) ShareShare
ReportReport
Posted on by

Been messing with this for an hour or two and embarrassed how lost I am...

 

I'm new to Power Apps. I would like the font size to change with the screen size. I can do that fine using this switch function:

 

Switch(App.ActiveScreen.Size, ScreenSize.Small, fontSmall, ScreenSize.Medium, fontMedium, ScreenSize.Large, fontLarge, ScreenSize.ExtraLarge, fontXL)

 

These font variables refer to a set of 4 variables I have tried defining in App.OnStart and this page's Screen.OnVisible. Both options leave all of the variables defined as blank. This is the code I have for those:

 

Set(fontSmall, 8);
Set(fontMedium, 12);
Set(fontLarge, 16);
Set(fontXL, 24);

 

Simple stuff! Yet I can't get my desired result... what am I getting wrong here? Is there a better way to approach this? Thanks.

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,273 Most Valuable Professional on at
    Re: Help defining static variables

    In the design environment App.OnStart needs to be run manually from the App object context menu.  When running the app in production it runs automatically. Until you do that in the designer those variables will be blank.

     

    The OnVisible property is also somewhat unreliable in the Designer because it runs when the screen is first loaded by the designer, which was before you modified the OnVisible property. Again, this is less of a problem in the production version.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 671 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 424 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 243

Last 30 days Overall leaderboard