Embedding a Component in a Component
Embedding a Component in a Component not only makes for a more streamlined-looking Component – it also hides the controls of the embedded Component from anyone who might get a look at the “host” Component.
Observe as the instructor embeds the MainButtons Component inside the login Component.
- Return to the login Component.
- Delete all the controls in Panel Card: PANEL_APPLICATION, and highlight its opening tag.
- In the Other Controls group, click EmbeddedObject.
- The Insert EmbeddedObject window appears.
Choose the MainButtons Component as shown here, and then click OK in this window:
- Alpha Anywhere embeds the MainButtons Component into the PANEL_APPLICATION control, as shown here:
- To protect the EmbeddedObject control even more from being seen by unauthenticated users, we should make sure it is not compiled and available until its Panel Card appears.
Mark the checkbox for the Delay render till visible Property, as shown here:
- Save the login Component.
- Finally, we should make sure that a user must log in to see the EmbeddedObject control.
- Make the Web Projects Control Panel active.
- Right-click the MainButtons file name.
- In the box that appears, choose Component Security, and then Requires login. A Groups dialog box appears:
- Mark checkboxes of all Groups, and click OK.
- Publish the application, selecting to publish “All files in project”. This time, mark the checkbox shown here:
Now you add an EmbeddedObject to your login Component, secure it, and modify the settings as done above.
Then, publish the application.