Hi xinjie,
You're welcome! Well, most of us I think come from the Clipper days, where everything was untyped and that was ok for that time, but since then computer languages have evolved a lot, and still not using strong typing may be handy at times, but loses so much in many aspects of writing code...
Unable to open forms created based on customized winform classes using the form designer
Re: Unable to open forms created based on customized winform classes using the form designer
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Re: Unable to open forms created based on customized winform classes using the form designer
Hi, Chris
I think I may have found another X# bug.
You can easily verify this using the attachment I provided( assuming that the issues raised earlier have been resolved ):
In Form1 of the Windows Forms Application project,If you type "This." or "self:",The list of members displayed is also “incomplete”.
It is similar to the previous “Questions about object members lists(https://www.xsharp.eu/forum/topic/4854)”.
But other controls based on custom classes (e.g. commands/labels, etc.) seem to show the normal list of members.
I think I may have found another X# bug.
You can easily verify this using the attachment I provided( assuming that the issues raised earlier have been resolved ):
In Form1 of the Windows Forms Application project,If you type "This." or "self:",The list of members displayed is also “incomplete”.
It is similar to the previous “Questions about object members lists(https://www.xsharp.eu/forum/topic/4854)”.
But other controls based on custom classes (e.g. commands/labels, etc.) seem to show the normal list of members.
Last edited by xinjie on Tue Oct 29, 2024 11:44 pm, edited 1 time in total.
简单的东西重复做,你能成为专家;重复的东西用心做,你能成为赢家!
Re: Unable to open forms created based on customized winform classes using the form designer
Hi xinjie,
Yes, that's the same bug.xinjie wrote: ↑Tue Oct 29, 2024 11:32 pm
I think I may have found another X# bug.
You can easily verify this using the attachment I provided( assuming that the issues raised earlier have been resolved ):
In Form1 of the Windows Forms Application project,If you type "This." or "self:",The list of members displayed is also “incomplete”.
It is similar to the previous “Questions about object members lists(https://www.xsharp.eu/forum/topic/4854)”.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Re: Unable to open forms created based on customized winform classes using the form designer
Hi, Chris
I have one more question:
If I use “This.Size = System.Drawing.Size{200, 200}” in the constructor of my custom form class "Form1", then after adjusting the Size of myForm inherited from Form1, I can use the shortcut menu in the properties window to “Reset” the Size of myForm.
However, if it is another custom class, such as Command, then the Size “reset” is not the Size specified in the custom Command class, but the Size of DotNet's Command.
I haven't tested the other properties, but I'm guessing that this situation may be a manifestation of the other properties as well.
Is this a bug?
I have one more question:
If I use “This.Size = System.Drawing.Size{200, 200}” in the constructor of my custom form class "Form1", then after adjusting the Size of myForm inherited from Form1, I can use the shortcut menu in the properties window to “Reset” the Size of myForm.
However, if it is another custom class, such as Command, then the Size “reset” is not the Size specified in the custom Command class, but the Size of DotNet's Command.
I haven't tested the other properties, but I'm guessing that this situation may be a manifestation of the other properties as well.
Is this a bug?
简单的东西重复做,你能成为专家;重复的东西用心做,你能成为赢家!
Re: Unable to open forms created based on customized winform classes using the form designer
Hi xinjie,
Sorry, I do not think I understood what you mean this time, which context menu are you using the to reset the size, and what is the Command class? Maybe you can show a couple screenshots to explain more?
Sorry, I do not think I understood what you mean this time, which context menu are you using the to reset the size, and what is the Command class? Maybe you can show a couple screenshots to explain more?
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Re: Unable to open forms created based on customized winform classes using the form designer
Hi, Chris
The following screenshots are arranged according to the operation steps: The operation shown in the above screenshot is reasonable.
However, if you are adding a custom button class to the form (that's what I mean by Command, sorry, I'm used to using VFP), then this operation will not restore the Size defined in the custom button class.
The following screenshots are arranged according to the operation steps: The operation shown in the above screenshot is reasonable.
However, if you are adding a custom button class to the form (that's what I mean by Command, sorry, I'm used to using VFP), then this operation will not restore the Size defined in the custom button class.
简单的东西重复做,你能成为专家;重复的东西用心做,你能成为赢家!
Re: Unable to open forms created based on customized winform classes using the form designer
Hi xinjie,
Ah, thanks, I had never seen that context menu with the Reset command! I was trying to invoke it by right click on the value area in the Properties window, but apparently this needs to be done on the property name area..
I do see the behavior that you described, but just made a similar test using c# only, and it has the exact same behavior, so it's not a bug in X#, it's just how the form designer works in VS. It resets the size of the control to the original size it would have if it wasn't inherited by your class. I know, doesn't make much sense, but it's the way it is unfortunately.
Ah, thanks, I had never seen that context menu with the Reset command! I was trying to invoke it by right click on the value area in the Properties window, but apparently this needs to be done on the property name area..
I do see the behavior that you described, but just made a similar test using c# only, and it has the exact same behavior, so it's not a bug in X#, it's just how the form designer works in VS. It resets the size of the control to the original size it would have if it wasn't inherited by your class. I know, doesn't make much sense, but it's the way it is unfortunately.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
Re: Unable to open forms created based on customized winform classes using the form designer
Chris, Xinjie,
I did not test this, but the Control Class Hierarchy has a virtual property DefaultSize.
I think that if you add an override of this property in your button or form class, that this is the size that you will get when you reset it.
The Default Size for a Form is 300 x 300.
Robert
I did not test this, but the Control Class Hierarchy has a virtual property DefaultSize.
I think that if you add an override of this property in your button or form class, that this is the size that you will get when you reset it.
The Default Size for a Form is 300 x 300.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Re: Unable to open forms created based on customized winform classes using the form designer
Hi Guys,
when you use the WinForm designer "Reset" command, it will get it from the source code.
If you haven't override it, it will take the default value of the WinForm library (that what is happening with the Command Button)
If you want to provide your own "Default Value", you will have to inherit from it, and indicate the "new one as an attribute.
You can have a look here :
https://github.com/X-Sharp/XSharpPublic ... verride.xh
So, you will have to override the Size property, and add an Attribute like :
[System.ComponentModel.DefaultValue( System.Windows.Form.Drawing.Size{ 250,250 }];
on top of the new Size property.
HTH,
Fab
when you use the WinForm designer "Reset" command, it will get it from the source code.
If you haven't override it, it will take the default value of the WinForm library (that what is happening with the Command Button)
If you want to provide your own "Default Value", you will have to inherit from it, and indicate the "new one as an attribute.
You can have a look here :
https://github.com/X-Sharp/XSharpPublic ... verride.xh
So, you will have to override the Size property, and add an Attribute like :
[System.ComponentModel.DefaultValue( System.Windows.Form.Drawing.Size{ 250,250 }];
on top of the new Size property.
HTH,
Fab
XSharp Development Team
fabrice(at)xsharp.eu
fabrice(at)xsharp.eu
Re: Unable to open forms created based on customized winform classes using the form designer
Hi xinjie,
Just a small thing, about this:
this.Deactivate += this.myForm_Deactivate
Just a small thing, about this:
Another way to workaround this is to prefix the method with this (or self), which will tell the compiler that you intend to use the method declared in the class and not possibly a memvar:Chris wrote: ↑Tue Oct 29, 2024 9:28 am 3. Also this code confuses the compiler, thinking again you are using a memvar:
this.Deactivate += myForm_Deactivate
The compiler thinks again that "myForm_Deactivate" represents a memvar, although I think that in this case it is a bug in X# and the compiler should realize that it's referring to a method, will open a ticket for this as well.
In order to fix this, you can simply again turn off memvar support (project options, Language page, disable "Enable Memvar Support" and "Enable Undeclared Variables Support"), so the compiler will now know for sure that you are referring to a method. If you do want to still be able to use memvars in the code, you can use an alternative syntax for registering events:
this.Deactivate += EventHandler{SELF, @myForm_Deactivate()}
this.Activated += EventHandler{SELF, @myForm_Activated()}
this will also fix the problem, but it's only a temp solution, it will not be always necessary to use this.
this.Deactivate += this.myForm_Deactivate
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu