Hi everyone,
I’m using the Dashboard form template and would like to use the left hand column as a menu. I can create one by dropping controls in there, but it looks like I have to recreate it for every form. Can I make a reusable one?
Can you recommend a good way to do this (or point me to docs)? I have searched for menu and navigation but can’t find anything.
Many thanks.
…and as soon as I hit “send” I notice a “duplicate” option on the form…
I assume that’s the way to do it, though it would still require editing every form if I make a change.
Is there a better way?
Hi, David.
I’ve read that a form can be used as a component in other forms. I haven’t tried it yet, but that might be a start.
Hi David,
You’re right that you can duplicate forms if you wish, but you correctly mention that it would make changing your menu difficult. @p.colbert has spotted one possible solution, and the one I use myself, which is to have precisely one “home” form, with navigation menu. You can then add “sub” forms to the main form as content via code. For example, in the code behind your main form:
def nav_link_click(self, **event_args):
# This method is called when the link is clicked
self.content_panel.clear()
self.content_panel.add_component(MySubForm())
(Of course this will require a container such as a ColumnPanel on your main form called content_panel
).
I hope that makes sense. Please do follow up and let us know how you get on.
That’s great, Ian.
I am working on an outline “component,” to be used in just such a fashion.
What would the import statement look like, for MySubForm?
Oh yes, sorry for missing that out.
Depending on your love for typing, either:
from MySubForm import MySubForm
or
from MySubForm import *
Will work
1 Like
Thanks all.
I shall work through those later this evening.
@ian - thank you for that detailed answer. Works perfectly.