cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dpalmer
Level: Powered On

FontWeight Semibold Variable

Hi,

I am setting up a styling page in an app. I'm using variables to store styling values. So for example, I created a variable for font size called "FS" and set its value to "21".  Then when adding a label to a form, I set its "Size" property to "FS".  This works and sets the font size of the label to 21.

 

I'm doing the same thing for font weight. Variable is "FW".  I set its value to "Bold".  Then I set the label's "Font Weight" property to "FW" and the font shows in bold.

 

Problem is when I try to use "Semibold" as the "FW" value.  This just does not seem to work. The values "Normal", "Bold", and "Lighter" all seem to apply the proper weight to the label when I assign that to the "FW" variable. But not "Semibold".

 

Anyone have a clue as to how I can make this work?

 

Thanks,

David

10 REPLIES 10
Super User
Super User

Re: FontWeight Semibold Variable

@Dpalmer 

This is what works for me...

 

Set(FW,FontWeight.Semibold);

 

If that does not work please share a screenshot of your code.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

Dpalmer
Level: Powered On

Re: FontWeight Semibold Variable

Thanks but I still have a problem.

 

So the detail is that I'm trying to use a dropdown to select the font weight value.  The variable is "LW" and I'm using this formula in an OnChange property of the dropdown itself:

 

If(Dropdown1_1.Selected.Value = "Bold", Set(LW, "Bold"), If(Dropdown1_1.Selected.Value = "Normal", Set(LW, "Normal"), Set(LW, "Semibold")))

 

This works for Bold and Normal, but not for Semibold.  Even if I adjust the last "Set" statement to be "Set(LW, "FontWeight.Semibold")

Super User
Super User

Re: FontWeight Semibold Variable

@Dpalmer 

You need to remove the quotes in red from your code just like my example showed.  Your code looks like this...

 

If(
Dropdown1_1.Selected.Value = "Bold", Set(LW, "Bold"),
If(Dropdown1_1.Selected.Value = "Normal", Set(LW, "Normal"), Set(LW, "Semibold"))
)

 

You might also like to use a SWITCH function for simplicity.

 

Switch(
Dropdown1_1.Selected.Value,
"Bold", Set(LW, Bold),
"Normal", Set(LW, Normal),
"Semibold", Set(LW, Semibold)
)

 

Let me know your questions.

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

Community Support Team
Community Support Team

Re: FontWeight Semibold Variable

Hi @Dpalmer ,

Do you mean that you can not use a variable to change a label's fontweight to Semibold?

I've made a similar test and found that what you talked about is true.

Using variable to change a label's fontweight to normal or bold is ok, while Semibold is not ok.

I've reported this issue to our product team.

If there's any reply about this, I will leave my message here.

Thanks for your feedback! 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Community Support Team
Community Support Team

Re: FontWeight Semibold Variable

Hi @Dpalmer ,

I've receviced reply.

Since the value of setting the fontweight is enumeration type, not constant type, so please not use "Bold","Normal","Semibold" to set.

The right format shouble be like: FontWeight.Bold,FontWeight.Normal, FontWeight.Semibold.

To sum up, you should use these formulas to set your buttons:

Set(var,FontWeight.Bold)   //button1's OnSelect
Set(var,FontWeight.Normal)   //button2's OnSelect
Set(var,FontWeight.Semibold)   //button3's OnSelect

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: FontWeight Semibold Variable

@v-yutliu-msft 

I think this is the same suggestion as what I had proposed earlier, right?  Am I missing something here?

Dpalmer
Level: Powered On

Re: FontWeight Semibold Variable

Thanks for the replies.  Still having an issue.  Thanks for the "Switch()" function tip!!

 

I'm using a dropdown control.  Set the OnChange property to:

 

Switch(
Dropdown1_1.Selected.Value,
"Bold", Set(LW, FontWeight.Bold),
"Normal", Set(LW, FontWeight.Normal),
"Semibold", Set(LW, FontWeight.Semibold)
)

 

What I noticed today is if I place a label on the form and assign its text value to "LW", the following is the results for each selection:

 

Select "Bold" from dropdown, LW = "bold"

Select "Normal" from dropdown, LW = "normal"

Select "Semibold" from dropdown, LW = "600"

 

So something very odd is happening here.

 

Thanks,
David

Super User
Super User

Re: FontWeight Semibold Variable

@Dpalmer 

Actually, you will be surprised to learn that this is completely normal Cat Surprised

 

The FontWeight property accepts only Enum values in PowerApps (FontWeight.Bold, FontWeight.Normal, etc.).  But I know from studying the CSS (cascading style sheets) language is FontWeight is set by an integer value within a web-browser.  Here's the hidden values for each font weight.  I can't say why this value is Visible in the label (I tested this too) but that's just the way PowerApps was made.

 

Normal: 400
Semibold: 600
Bold: 700

 

That being said, were you able to resolve the initial problem? Cat Wink

 

Dpalmer
Level: Powered On

Re: FontWeight Semibold Variable

Oh thanks!

 

No the problem still exists. The variable is being set to "600" not "Sembold" so I assume when I apply that vairable to the FontWeight properties of objects, it doesn't know what to do.  


David

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,689)