web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

How to expand tree view by default when page open in navision?

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have a page with show as tree property True. But when i run the page by default it was displayed in Collapse mode but i want to in expand.

i have done some R&D i found that below code 

IF (ISCLEAR(WshShell)) THEN BEGIN
CREATE(WshShell, FALSE, TRUE);
END;
WshShell.SendKeys('+{F10}E{ENTER}');
// menu key + E + Enter
CLEAR(WshShell);

But it is with the automation not working for my NAV 2013 R2. my page type is listpart. any other alternative way for the default expand in tree view.

Please let me know.

Thank You

--

Ramesh

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    See this if you get some hint

    rockwithnav.wordpress.com/.../update-flowfields-at-runtime-no-need-to-refresh

    May be you SendKeys needs to be written twice.

    Make sure you are writing at correct trigger.

  • Community Member Profile Picture
    on at

    Hi,

    Thanks for the reply. Please confirm me WshShell.SendKeys('+{F10}E{ENTER}'); this key is correct?

    Thank You

    Ramesh

    --

  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    Check this out

    msdn.microsoft.com/.../system.windows.forms.sendkeys.send(v=vs.110).aspx

  • Community Member Profile Picture
    on at

    Hi,

    I have a below page line like as sales subform.

    Expandcollapse.PNG

    And when page is loaded it need to be default expand how should i do. i found some sendkey code as below


    IF (ISCLEAR(WshShell)) THEN BEGIN
    CREATE(WshShell,FALSE,TRUE);
    END;
    WshShell.SendKeys('^+{Q}');
    // menu key + E + Enter
    CLEAR(WshShell);

    manually Cntrl+Shift+Q is working for line hierarchy but when i written this code in OnOpenpage trigger not working.


    IF "Is Parent" THEN
      WindowShell.Send('^+{Q}'); //^+{Q}

    ^+{Q} := Cntrl+Shift+Q (this is manually working)

    And also above code is also not working in OnAftergetrecord trigger.

    In which trigger i can place this code. even i have placed in Element name that is parent node onValidateTrigger but still not working. 

    Please any one suggest me how to achieve. or any alternative way to achieve this situation.

    Thank You

    Ramesh

  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    It will obviously not work from OnOpen Trigger because its the Trigger of the main page not subform. You need to write on SubForm OnOpen  trigger and then it needs to be called from the main Page.

  • Community Member Profile Picture
    on at

    Hi,

    i have Written in Subform OnOpen trigger only, not on main page.

    any other possibility for this?

    Thank you

    Ramesh

    --

  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    See there's only two things that need to be taken care of.

    1. SendKey should be correct if you are not passing it correct you wont get any Error but it will not work.

    2. Trigger should be correct, OnOpen Trigger should work I believe, Possiblly you can try on some other triggers.

    Make sure SendKey is correct, Check in some different short program, make confirm then go for triggers.

  • Community Member Profile Picture
    on at

    Hi,

    I have checked manually cntrl+shift+Q is worked for collage and expand.

    I found keystrokes for cntrl as ^ ,shift +,{Q},

    So totally my send key is '^+{Q}'.

    Is above key I am passing is correct or do I need to change any thing.

    Please suggest me.

    Thanks you

    Ramesh.

  • Community Member Profile Picture
    on at

    Hi,

    above send key was worked  on active application.

    Name DataType Subtype Length

    WindowShell DotNet System.Windows.Forms.SendKeys.'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    WindowShell.Send('^+{Q}');

    but i want to work this when loading a page. any one suggest the solution to resolve.

    Thank you

    Ramesh

    --

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Ramesh,

    If you add an action on the page and add the above code is it working ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans