cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ZowieS
Advocate II
Advocate II

Problem with hiding menu when entering a screen

Hi,

 

I have a Expanding/Collapsing/Hide menu in my app but it doesn't work as I need it to. Maybe it's a bug in Power Apps?

 

What I want

When a user enters a screen the menu should be hidden and the user need to press a button if he/she wants to see the menu.

I need it to be hidden since I need that extra space in my app.

 

The Problem

In Play mode

The auto-hide function doesn't work at all. I have to manually hide the menu every time I enter a screen.

 

How I enter the "Play" mode
1.png 

In Studio Mode -> Preview (F5)

It works as it should the first time I enter a screen but then it doesn't until I
- Close the app and opens it again

- Or wait and it might have fixed it self.

 

The App

The Code
On 3 of my 4 screens I have this code in the OnVisible property of the screen:

If(
    expandCollapse = false,
    UpdateContext({expandCollapse: true})
)


And my hamburger menu has this code on it's OnSelect property: 

UpdateContext({Timer: false});
UpdateContext({expandCollapse:!expandCollapse, Timer:true})

 

 

The Source/Foundation 

I followed this video and used it as the foundation for my menu: https://youtu.be/D_Kb7AXSE0s
Start at 7:24: https://youtu.be/D_Kb7AXSE0s?t=444
End at 20:04: https://youtu.be/D_Kb7AXSE0s?t=1202

 

 

Anyone have any tips or ideas on how to solve this?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ZowieS :

I got it!The reason lies in the timer.

Just change one place:

Set the screen's OnVisible proeprty to:

 

UpdateContext({Timer:false});UpdateContext({expandCollapse:false,Timer:true})

 

28.gif

Best Regards,

Bof

View solution in original post

4 REPLIES 4
v-bofeng-msft
Community Support
Community Support

Hi @ZowieS :

Could you tell me?

  • Do you want the menu to be hidden every time the user opens a new screen?
  • What is the visible property of the menu?
  • Is it 

 

!expandCollapse

 

      ?I think it should be !expandCollapse.

I suggest you try again using global variables.

The Code
On 3 of my 4 screens I have this code in the OnVisible property of the screen:

 

If(
    !expandCollapse,
    Set(expandCollapse,true)
)

 

And my hamburger menu has this code on it's OnSelect property: 

 

Set(Timer,false);
Set(expandCollapse,!expandCollapse);Set(Timer,true)

 

If it still doesn't work, could you provide more detailed information about your app?

Best Regards,

Bof

 

Hi @v-bofeng-msft,

 

Thanks for your reply!


Question:


@v-bofeng-msft wrote:

Hi @ZowieS :

Could you tell me?

  • Do you want the menu to be hidden every time the user opens a new screen?

Answer:

Yes, that is correct.


Question:


@v-bofeng-msft wrote:

Hi @ZowieS :

Could you tell me?

  • What is the visible property of the menu?
  • Is it 

 

!expandCollapse

 


Answer:

 

The Visible property is set to true.

And the X property is set to: 

 

 

If(expandCollapse,-'Navigation-Background_4'.Width + 'Navigation-Background_4'.Width * ('Timer-NewRequestScreen'.Value/'Timer-NewRequestScreen'.Duration),-'Navigation-Background_4'.Width * ('Timer-NewRequestScreen'.Value/'Timer-NewRequestScreen'.Duration))

 

 

 

Question:

 


@v-bofeng-msft wrote:

I suggest you try again using global variables.


Answer:
The variable "expandCollapse" only exist on 3 out 4 screens since there is no need for it on the Main/First screen.

The Main/First screen only contains a picture and the navigation.

 

Question:


@v-bofeng-msft wrote:

The Code
On 3 of my 4 screens I have this code in the OnVisible property of the screen:

 

 

 

If(
    !expandCollapse,
    Set(expandCollapse,true)
)

 

 

And my hamburger menu has this code on it's OnSelect property: 

 

 

Set(Timer,false);
Set(expandCollapse,!expandCollapse);Set(Timer,true)

 

 

 

If it still doesn't work, could you provide more detailed information about your app?

Best Regards,

Bof

 

Answer:

Sorry, there is no different from my set-up.


I recorded of what doesn't happen when I try it in Play -mode
Link: https://youtu.be/APm8qGRZs7Y  

 

Hi @ZowieS :

I got it!The reason lies in the timer.

Just change one place:

Set the screen's OnVisible proeprty to:

 

UpdateContext({Timer:false});UpdateContext({expandCollapse:false,Timer:true})

 

28.gif

Best Regards,

Bof

Thank you!

That worked great!

 

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,607)