Completed
Last Updated: 03 Oct 2019 11:41 by ADMIN
Release R3 2019 SP1 (LIB 2019.3.1007)
Robert
Created on: 31 Jul 2019 16:38
Category: ColorDialog
Type: Bug Report
1
RadColorDialog: How can the CustomColorsConfigLocationNeeded event be fired on ColorDialog open?

Hello,

The CustomColorsConfigLocationNeeded event fires on dialog close but does not seem to fire on dialog open or load. So I can save a custom location for the custom colors when the dialog is closed but can't reference that location when the dialog is subsequently opened again. What am I missing?

Best regards,

Robert

 

 

 

3 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 01 Aug 2019 14:13
Hello, Robert,

The LoadXML method of the CustomColors object is called when you initialize the RadColorDialog. At this point you don't have subscription to the CustomColorsConfigLocationNeeded from where to extract the configuration folder. That is why the custom colors are read from the default ConfigLocation when starting the application. In other words, while the application is running, you can change the the ConfigLocation and use it for saving the colors to the XML. But when you restart the application, the RadColorDialog is initialized again and at the point of initialization, you don't have subscription to the CustomColorsConfigLocationNeeded event yet.

After further discussion with the team, we have decided to offer this CustomColorsConfigLocationNeeded event for the initial loading of the custom colors as well since this behavior is misleading.

I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to copy/paste th file from your custom location to C:\Users\'User Name'\AppData\Local.

Steps to reproduce:
1. Run the attached sample project and click the button.
2. Add several custom colors and click OK.
3. Click the button again to open the color dialog. You will notice that th custom colors are there.
4. Restart the application and open the color dialog. You will notice that stored custom colors in the local folder are not loaded.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Robert
Posted on: 01 Aug 2019 11:22

Hi Dess,

Yes, the custom_colors.cfg file works well at the default location. But we want it stored in the same folder as all our other application settings files. The default location is as you pointed out in the AppData/Local folder. But that doesn't always work for users on a locked down network. We need it in the AppData/Roaming folder in our application folder.

Using the CustomColorsConfigLocationNeeded event we can easily change that location when the ColorDialog closes because the event actually fires at that time. So the custom_colors.cfg is saved to our desired folder. So far so good.

Private Sub _myColorSelector_CustomColorsConfigLocationNeeded(sender As Object, args As CustomColorsEventArgs) Handles _myColorSelector.CustomColorsConfigLocationNeeded

        args.ConfigLocation = FileUtilities.AcquireApplicationDataFolder(False)
End Sub

However, that event does not fire when the ColorDialog is opened again. So the dialog does not know that there is a new location for the custom_colors.cfg file and continues to look in the default location.

So how do we get the ColorDialog to recognize and use the new location?

 

 

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 01 Aug 2019 05:47
Hello, Robert,

The RadColorSelector.CustomColorsConfigLocationNeeded event fires when custom colors configuration is about to be saved and loaded at a later moment. In the CustomColorsEventArgs you have the option to change the location  of the custom_colors.cfg. When creating the CustomColors, RadColorDialog checks whether a custom_colors.cfg file exists to load the colors. The default location is C:\Users\'User Name'\AppData\Local. You can create a default file with a predefined set of colors at the specified location. Thus, the desired colors will be loaded. 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.