Page 1 of 1

Customize the built-in menu bars and panes

Posted: Mon Apr 23, 2018 11:39 pm
by Shaun Luttin
We would like to use parts of the built-in menu bars and panes. For instance, in the Zoom bar, we might only want to expose the slider. How can we do that programmatically?
Capture.PNG

Re: Customize the built-in menu bars and panes

Posted: Tue Apr 24, 2018 9:56 am
by Tracker Supp-Stefan
Hello Shaun,

The easiest way would be to install the end user Viewer, customize the UI there to the way you want it - and then export the settings to a data file.
Then use the LoadSettings() method to load that file in the AX control immediately after you load the control itself in your project.

Regards,
Stefan

Re: Customize the built-in menu bars and panes

Posted: Tue Apr 24, 2018 4:36 pm
by Shaun Luttin
Thank you. We'll give that a try.

Re: Customize the built-in menu bars and panes

Posted: Wed Apr 25, 2018 8:34 am
by Tracker Supp-Stefan
:)

Re: Customize the built-in menu bars and panes

Posted: Tue May 01, 2018 6:56 pm
by Shaun Luttin
We tried that and are receiving an exception that says, "Source storage is wrong."

Re: Customize the built-in menu bars and panes  SOLVED

Posted: Wed May 02, 2018 12:52 am
by Shaun Luttin
We were able to make this work by exporting the settings from our application instead of from the end-user viewer. This is how we did it.

Code: Select all

public void SaveSettings() {
    try {
        // SavePath is an absolute path to a *.dat file
        var obj = SavePath as object;
        _viewer.SaveSettings(ref obj);
    }
    catch (Exception ex) {
        _viewer.GetTextFromResult(ex.HResult, out var text);
        Pd.Trace(text);
    }
}

public void LoadSettings() {
    try {
        // LoadPath is an absolute path to a *.dat file
        var obj = LoadPath as object;
        _viewer.LoadSettings(obj);
    }
    catch (Exception ex) {
        _viewer.GetTextFromResult(ex.HResult, out var text);
        Pd.Trace(text);
    }
}

Re: Customize the built-in menu bars and panes

Posted: Wed May 02, 2018 11:11 am
by Tracker Supp-Stefan
Glad to hear all is now solved Shaun Luttin,

And thanks for sharing it for everyone to see!

Cheers,
Stefan