I've a problem with WinTextEditor controls when using app style file. Fortunately I've managed to extract the problem into a small project that I can forward to you. Unfortunately I do not see the possibility to upload the ZIP-file with the project in this forum anymore although I'm sure that I've done it before.The example is rather simple. I've three text boxes that should display first, middle and last name. The middle name is optional while both first and last name are mandatory. What I'm doing in code is whenever those two text boxes have an invalid value I apply a different style set that is set in the style file to just have a yellow background. What happens now is that when I apply the style set the height of the text box changes. The strange thing here is that one text box gets 1 pixel less, the other 1 pixel more in height. I don't know if it is related to the UltraGridBagLayoutPanel I'm using but I leave that you guys ;-)In this demo I'm simulating the event to validate the text boxes by pressing the button on the form.
Pls let me know how and where I can upload my ZIP-file with the demo project.Regards,Wolfgang
Hello Wolfgang,
I tried loading such style and did not get the mentioned behavior, please take a look at my sample.
As to the attachments - you could attach your archive while writing your next post from the 'OPTIONS' tab above and then 'Add/Update'.
I will be waiting for your feedback.
Hi Boris,
thanks for your instant reply. I didn't expect to find the possibility to add an attachment under Options so I didn't event click on that :-) Now I've added my small example, hope you can follow the problem.
I forgot to write about the environment I'm using so I'll catch up that now:
NetAdvantage 12.2.20122.2018
Visual Studio 2012
Windows 7 Enterprise 64 bit
Thanks in advance for your supportWolfgang
I created the following case for you: 'CAS-109862-C5F9X0' and will update you through it.
You could use the 'PerformLayout()' method of the 'GridBagLayoutPanel' after setting the styles. Another advise - if not necessary, use the same fonts in every style set in order to avoid such behaviors.
ultraGridBagLayoutPanel1.PerformLayout();
Did you know that the StyleSets you are using here are changing the Font of the controls? Your default StyleSet has a Font applied to the UltraTextEditor, but your InvalidText StyleSet did not. That's why the size of the controls is changing at all - because it's auto-sizing the height based on the font. Changing the font based on state seems like a really weird thing to do, so I am wondering if you did that intentionally or if it was a mistake.
Hi Mike,
you are totally right, it was not my intention to set another font and after changing it in the demo application that worked fine there. I changed it in the 'real' application but the problem remained so I investigated deeper. The problem is that I apply the default style to some controls and some time after another style which leads to the problem. I managed to transfer this behavior to the demo application. There are now two forms, Form1 still has the UltraGridBagLayoutPanel while Form2 simply has the controls owned directly on the Form without using the layout panel. The behavior is more or less the same. The strange thing is that all 3 text boxes are set from VS Designer to have a height of 21 pixels. After applying the styles to ultraTextEditor1 and ultraTextEditor3 both have the size of 21 pixels while ultraTextEditor2, where there never has been a style applied, has 19 pixels. If I remove line 13 from the Style file it works fine and all 3 controls have the size of 21 pixels. I removed all occurences of 'font' in the style file but the problem remains. It seems, that there is something strange when the default style is applied to the UltraTextEditor control.
Find the adapted demo application to this post.
Regards, Wolfgang
Okay... the issue here is with the AutoSizing of the control. It's good that you were able to remove the GridBagLayoutPanel from the equation. The GridBagLayoutPanel is not really the problem here, the problem is coming up because the UltraTextEditor is autosizing differently.
In this case, it happens because your default StyleSet is setting the control to FlatMode and your "Invalid Value" StyleSet is not. So once again, you are changing properties that you probably didn't mean to change. This is a result of the fact that there is no connection between your Default StyleSet and your Invalid Value StyleSet. So applying the Invalid Value StyleSet compeltely removes any setting from the Default StyleSet.
If all you want to do is apply a color to the controls with invalid values, then it would make more sense to set up your "Invalid Value" StyleSet to derive from your Default StyleSet and just override the color. You do this by setting the BasedOn field. You could do this through AppStylist by using the Manage StyleSets dialog. Or you could edit the XML and change:
<styleSet name="Invalid Value">
to:
<styleSet name="Invalid Value" basedOn="Default">
after setting attribute 'basedOn' to 'Default' for all style sets it's working fine, both in the Demo application and in the 'real' application.
Although the AppStylist program is a powerful tool it's not very intuitive to work with thus such problems can be the result of playing around to get things to look like as wanted. Sometimes it was easier for me to change it directly in the Style-file as I did now for this particular problem.
Thanks for your support,Wolfgang