Navigating to a Container in a Form


#1

I’m trying to navigate to a particular container on another form. How can I do this?

For example, I have a Calendar app with each month as a separate form. I want to move to a Container on a form that shows info for a particular day - say April 25

I can go to the form with ChangeForm(April)

But if I use ContainerApril25.show() it does nothing. I have tried placing this in the calling button and in the April_onshow event but neither works.

Any help would be appreciated.

I’m still using version 6.1 - have downloaded but not updated to 7 yet.


#2

Does ContainerApril25.show() work if you enter it into the Chrome Console?


#3

Thanks for your help.

No. If I enter ContainerApril25.show() I get a response of “undefined”

I’ve even tried a button on the April form which executes only ContainerApril25.show() which also does nothing.

However in the April_onshow event I set the InnerHtml of ContainerApril25 and it works perfectly???


#4

If ContainerApril25.show() is undefined, then it won’t do anything when you execute it.

Do you have such a function in your code?


#5

I thought that the Control.show() was a built in function that caused the page to move to and display that control.

I have not created a show () function in my code. If I need to what do I put in it to move the page to display the control?

Do I need to create such a function for each control I want to move to? The would be 365 in my case.


#6

Container.show() and Container.hide() will show and hide Container controls respectively.

Is ContainerApril25 a Container control?

What do you get when you type ContainerApril25 into the Console?
It should be something like:

<div id="Container1" class="" style="font-family: inherit; border-width: 1px; 
border-color: rgb(224, 224, 224); display: block;" data-i18n="Content">
Content</div>

#7

Yes ContainerApr25 is a container control this what I see in console when I type in ContainerApr25

but when I type in ContainerApr25.show() I just get undefined and it does nothing.

What I’m trying to do is have a Today button on another form that takes the user to the container corresponding to today’s date.


#8

How is ContainerApr25 created?

AppStudio adds .hide() and .show() functions to the Containers it creates.


#9

ContainerApr25 (and ContainerApr1 to 30) are dragged onto the form from the Bootstrap toolbox at design time.
The id=ContainerApr25 at design time. They are then populated at run time by setting the innerHTML property to represent the days of the month and various information about the day.

Does show() just make the container visible - rather then scrolling the page to it?

Is there some other function that can scroll the page to a container?


#10

I found the solution and it’s very easy.

Looks like the container supports the javascipt scrollIntoView function. This is not documented anywhere in NSBasic but it works.

From my menu form I issue the ChangeForm(Apr) command then in the Apr form I issue the ContainerApr25.scrollIIntoView() command … AND IT WORKS!!!

Thanks for your help.


#11

Thanks for posting your solution.

AppStudio exposes the JavaScript environment. Everything which is available there can be used by AppStudio apps. There’s a ton more stuff than we have documented!