question

Maksim B avatar image
1 Like"
Maksim B asked Ben Wilson answered

Automatically scroll windows after open

In my GUI window I have some text and few hyperlinks. Is there a way to automatically sroll the window after click the button which open the GUI window to the specific hyperlink position.

For example, I define in code int x=5; so after I open the GUI window I want it to scroll automatically to the position of 5th hyperlink points to.

FlexSim 20.0.7
flexsim 20.0.7automaticallyhyperlinkscroll
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeff Nordgren avatar image Jeff Nordgren commented ·

@Maksim B,

To receive a more accurate solution, please post your model or something similar that demonstrates your question. Proprietary models can be posted as a private question for FlexSim U.S. support only.

0 Likes 0 ·

1 Answer

Ben Wilson avatar image
0 Likes"
Ben Wilson answered

Hi @maksim.b,

You can use the FlexScript function callwebscriptmethod() to call Javascript functionality in an HTML GUI widget from other FlexSim GUI widgets.

Here is an example model: callwebscriptmethod-linkExample.fsm

Under the Toolbox you can examine "GUI 1" to see how this is built. Here are the basics:

  • test HTML page content is from https://github.com/cbracco/html5-test-page/blob/master/index.html
  • There is a single callwebscriptmethod call on the Go! button that calls a function innerLinks that is defined at the bottom of the html, passing the user typed CSS Selector string.
  • The innerLinks Javascript function is very basic, and can be found at the very bottom of the HTML content. You could include a JS library or other logic to enable smooth scrolling to your inner links, or perform other more advanced JS in the page.

Let us know of any questions.


5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.