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

Change another controls DisplayMode from clicking a Button

Hello all, I am stumped on this. I am trying to change the DisplayMode of a PenInput control via clicking a Button. I've tried using a button to set the DisplayMode of the PenInput from View(default) to Edit but when I click the button it doesn't do anything to the DispayMode of the PenInput control.

 

My PenInput's DisplayMode is set to 

DisplayMode.View

My Button's OnSelect is set to

PenInput1.DisplayMode.Edit

Am i missing something really obvious here?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Change another controls DisplayMode from clicking a Button

Hi @rbhurjee 

You could use a Context variable to define the display mode and then use it in the DisplayMode property of the control. Set the button's OnSelect property to 

UpdateContext({dmv: DisplayMode.Edit})

and set the PenInput control's DisplayMode property to dmv. ("dmv" is an arbitrary name for the variable).

You could toggle the PenInput control display mode by doing the following in the button's OnSelect:

If(PenInput1.DisplayMode=Edit,UpdateContext({dmv: DisplayMode.View},UpdateContext({dmv: DisplayMode.Edit})

You would use UpdateContext({dmv: DisplayMode.View}) in the OnVisible property of the Screen to set the default display mode property of the PenInput control.

 

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Change another controls DisplayMode from clicking a Button

Hi @rbhurjee 

You could use a Context variable to define the display mode and then use it in the DisplayMode property of the control. Set the button's OnSelect property to 

UpdateContext({dmv: DisplayMode.Edit})

and set the PenInput control's DisplayMode property to dmv. ("dmv" is an arbitrary name for the variable).

You could toggle the PenInput control display mode by doing the following in the button's OnSelect:

If(PenInput1.DisplayMode=Edit,UpdateContext({dmv: DisplayMode.View},UpdateContext({dmv: DisplayMode.Edit})

You would use UpdateContext({dmv: DisplayMode.View}) in the OnVisible property of the Screen to set the default display mode property of the PenInput control.

 

View solution in original post

rbhurjee
Level: Powered On

Re: Change another controls DisplayMode from clicking a Button

@Drrickryp awesome! 

 

Just for others reading this in the future, had to change your button's OnSelect to:

If(PenInput1.DisplayMode=Edit,UpdateContext({dmv: DisplayMode.View}),UpdateContext({dmv: DisplayMode.Edit}))

was missing a couple brackets Smiley Surprised

 

Thank you so much for the quick post!

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

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 (Last 30 Days)
Users online (5,490)