I have a container that will not show when the app loads onto homescreen, this is because its blank. In order for it to show it needs to be true, however, this means it willl always show, and if i set it to true which will result in there being two containers squashed on the screen. I have tried the below to check if its blank, and the set it to true if blank etc.
UpdateContext({showNM:If(showNM = Blank(), true, If(showNM = true, true, If(showNM = false, false)),false))
However, this does not work, i think it is due to using "UpdateContext" within the visible attribute.
Thank you
Hi @PowerNovice ,
Try This Code
// Initialize the 'showNM' variable in the OnStart event
Set(showNM, false);
// Use this in the Visible property of your container
Visible = showNM
// To toggle visibility of the container, use the following in a button's OnSelect event
UpdateContext({showNM: !showNM});
// Ensure the navigation menu is not duplicated by checking before collecting items
If(IsEmpty(colNavMenuItems),
Collect(colNavMenuItems, {
ScreenName: "Home",
Screen: LandingScreen
// ... add other menu items here
})
);
// Set the user variable without causing duplication
Set(varUser, User());
Please accept this solution if it resolves the issue. ✅
Best regards,
Muhammad Ali
I think the problem for duplication is because i am initializing the nav menu in onstart as well, but it doesnt make sense because im also doing set(varUser,User()) with no problems at all.
Hi @PowerNovice
t seems you're facing issues with duplicating the navigation menu and the container not displaying correctly. To fix this:
These steps should help you resolve the problems and achieve the desired behavior without unintended side effects.
Hi @PowerNovice
In This Code
The code UpdateContext({showNM: !showNM}) is used to toggle a variable called "showNM" between true and false. If "showNM" is currently true, it will become false, and if it's currently false, it will become true. Make sure to initialize "showNM" with an initial value,
Use the same button for true or false
Please accept this solution if it resolves the issue. ✅
Best regards,
Muhammad Ali
@M_Ali_SZ365 i now remember why i deleted that way of doing it, it duplicates the navigation menu in the sidebar. It also doesnt show the container that i need it to.
Hi @M_Ali_SZ365,
I tried initialising the variable at the start but it was a throwing an error, the only thing thats different on this example from the first way i tried is before the long way i posted on this, is you've done "!showNM" whereas i set that to true or false.
I'll give your way a go now. Thank you!
Hi @PowerNovice ,
First, set up your context variable when the app starts. This is usually done in the OnStart event of the app:
Set(showNM, true);
Next, for the container's Visible property, simply reference this variable:
showNM
This means when the app loads, showNM is set to true, so your container will show. When showNM is false, the container will be hidden.
If you want to toggle this variable within the app, use a button or some other control with the following code:
UpdateContext({showNM: !showNM});
This will switch showNM between true and false each time the button is pressed. Remember, UpdateContext is used for local variables, and Set is used for global variables that are accessible across screens.
Please accept this solution if it resolves the issue. ✅
Best regards,
Muhammad Ali
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.