Nevron Forum

Load default scheme

https://www.nevron.com/Forum/Topic2845.aspx

By Gary Smith - Friday, December 18, 2009

Hi, I'm calling teh NUIManager ShowEditor() and everything works fine there. However, I want my users to be able to select thier default scheme, and have that load when the program loads. I'm not sure how to acomplish saving the default scheme the user selected, nor how to recall it... can you give me an example?  Using VB Visual Studio 2008. Thanks.

Gary

 

By Angel Chorbadzhiev - Sunday, December 20, 2009

Hi Gary,

 

You can save and load a NUIPalette into a file using NUIPalette.Save and NUIPalette.Load or NUIPalette.SaveToFile and NUIPalette.FromFile methods.

 

Regards,

Angel.

By Gary Smith - Sunday, December 20, 2009

Hi Angel,

I tried the methods you suggest however,

The methods NUIPalette.Load and .Save do not exist Or maybe I'm calling it wrong. I tried  NUIManager.Palette.Load() but it brings up the interface instead of just loading the file ("hcms.xml"). The NUIPalette only allows FromFile() which asks for a filepath as string - no problem, but also requires a System.Type which I'm not sure what its looking for.

To clarify what I need to do:

 

1) Open up the editor by calling NuiManagerController1.Palette.ShowEditor()

2) allow the user to select thier color scheme

3) Save the color scheme to a file (default filename if possible)

4) Change the scheme on the fly (doing this no problem)

5) Load the saved scheme/file on startup without interaction from the user

 

Hope that helps.


Thanks
Gary

 

By Angel Chorbadzhiev - Wednesday, December 23, 2009

Hi Gary,

To save a palette in specified location without getting a Save File Dialog you need to use SaveToFile method.

To load previously saved palette from a specified location call FromFile method.

This method has two parameters first one is a file name and the second one is the type that you save palette is. In your case this is NUIPalette. Also you need to cast the value that this method returns to NUIPalette.

'Saving palette

NUIManager.Palette.SaveToFile(fileName)

'Loading palette

Dim palette As NUIPalette = TryCast(NUIPalette.FromFile(fileName, GetType(NUIPalette)), NUIPalette)

NUIManager.Palette = palette

Regards,

 Angel.

By Gary Smith - Wednesday, December 23, 2009

Angel, thanks! I would never have gotten that.... appreciate the help!

Wish you, your family and all the members of NEVRON a VERY MERRY CHRISTMAS!

Gary

 

By Gary Smith - Monday, December 28, 2009

Angel, one last question on this subject....

Is it possible to add a custom name in the edit Palette control you provide? I would like to name a palette 'HCMS'  (Name of the program). Is that possible?

Thanks
Gary

 

By Angel Chorbadzhiev - Monday, January 4, 2010

Hi Gary,

Unfortunately you cannot add a new predefined palette in Palette Editor.

Regards,

Angel.

By Gary Smith - Monday, January 4, 2010

Not a show stopper, lol... thanks for the reply!