We have Winforms form, see MyWindow.prg with a toolbar with some buttons. I see that there's a right mouse menu option View code in the MyWindow.prg [Design].
The code behind of the buttons resides in a separate program MyWindowCode.prg. When I try View code the code file MyWindow.prg is opened and the cursor is placed on top. But that's not where my code is.
Now I have to open a Properties tab first, copy the name from (Design) and paste it in a solution wide Search box.
Is there something I can do to do that less time consuming?
Dick
Winforms ViewCode does not open code
Winforms ViewCode does not open code
Hi Dick,
I think that "View Code" is not specific to the element you are on, it just open the file that contains the User-Code of the Form.
To jump to the code that replies to an event, either you doubleclick on the control, and it will open/create the method that replies to the default event, or you can go to the Properties panel, select the lightning icon (Event) then doubleclick on the corresponding event...it should jump to the code.
HTH,
Fab
I think that "View Code" is not specific to the element you are on, it just open the file that contains the User-Code of the Form.
To jump to the code that replies to an event, either you doubleclick on the control, and it will open/create the method that replies to the default event, or you can go to the Properties panel, select the lightning icon (Event) then doubleclick on the corresponding event...it should jump to the code.
HTH,
Fab
XSharp Development Team
fabrice(at)xsharp.eu
fabrice(at)xsharp.eu
Winforms ViewCode does not open code
Hello Fabrice,
Unfortunately neither of these methods work. For some reason 1 of the (currently 4) toolbar button click methods resides in MyWindow.prg. The doubleclick (button or event) always opens that specific event while 3 of the events, residing in the separate MyWindowCode.prg never open (even though the name shows correctly in Click.)
It looks to me that if the code isn't in the windows with the same name as the Designer, X# is unable to find the code.
Dick
Unfortunately neither of these methods work. For some reason 1 of the (currently 4) toolbar button click methods resides in MyWindow.prg. The doubleclick (button or event) always opens that specific event while 3 of the events, residing in the separate MyWindowCode.prg never open (even though the name shows correctly in Click.)
It looks to me that if the code isn't in the windows with the same name as the Designer, X# is unable to find the code.
Dick
Winforms ViewCode does not open code
Dick,
The normal behavior (also for C#) is that the contents of the Form.prg and Form.designer.prg are merged into one logical codemodel and fed to the Window Editor. Each "CodeObject" in this CodeModel is marked with a property that indicates where it came from, so when saving the fields and methods are written back to the same file.
If you have code in another file then this is not included in this Codemodel and therefore the double click does not select it.
AFAIK this is also true for C#.
Robert
The normal behavior (also for C#) is that the contents of the Form.prg and Form.designer.prg are merged into one logical codemodel and fed to the Window Editor. Each "CodeObject" in this CodeModel is marked with a property that indicates where it came from, so when saving the fields and methods are written back to the same file.
If you have code in another file then this is not included in this Codemodel and therefore the double click does not select it.
AFAIK this is also true for C#.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Winforms ViewCode does not open code
Hello Robert,
I'll add it to my growing list of things-that-get-worse-in-VS-compared-to-VO.
Dick
You are right; I tried it in C# and I see it doesn't work there either.robert post=23447 userid=253 wrote: If you have code in another file then this is not included in this Codemodel and therefore the double click does not select it.
AFAIK this is also true for C#.
I'll add it to my growing list of things-that-get-worse-in-VS-compared-to-VO.
Dick
Winforms ViewCode does not open code
Dick,
I can probably make it work. Can you create a GitHub ticket for this so I will not forget to look at this.
Robert
I can probably make it work. Can you create a GitHub ticket for this so I will not forget to look at this.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Winforms ViewCode does not open code
Hello Robert,
Kees informed me that he moved the code to a different program because of an earlier X# bug where he lost code in the code behind. This bug was fixed so personally I think I keep the program, but move the click event to the code behind program, calling the actual code in the separate program. So it would certainly be good if you can indeed fix it but I would give it low priority.
I have created a throw away Github account szh48002 to post a a GitHub ticket, #1103.
Dick
It would be quite something that you would (again) fix something which Microsoft is unable to, or just don't care.robert post=23452 userid=253 wrote: I can probably make it work. Can you create a GitHub ticket for this so I will not forget to look at this.
Kees informed me that he moved the code to a different program because of an earlier X# bug where he lost code in the code behind. This bug was fixed so personally I think I keep the program, but move the click event to the code behind program, calling the actual code in the separate program. So it would certainly be good if you can indeed fix it but I would give it low priority.
I have created a throw away Github account szh48002 to post a a GitHub ticket, #1103.
Dick
Winforms ViewCode does not open code
Dick,
Robert
There is no ticket 1103 (anymore). If you have deleted your account then it has been deleted with it.ic2 post=23462 userid=455 wrote:Hello Robert,
I have created a throw away Github account szh48002 to post a a GitHub ticket, #1103.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
Winforms ViewCode does not open code
Hello Robert,
I didn't delete it. But it's Microsoft, so it is to be expected that it doesn't work.
Dick
I didn't delete it. But it's Microsoft, so it is to be expected that it doesn't work.
Dick
Winforms ViewCode does not open code
Dick,
I would not define that as "it does not work". Maybe it does not work as you would expect it.
If you delete an account, what should happen with the issues reported by that account?
Apparently, someone decided that since nobody else interacted with the issue, this issue was yours and yours only, so it should be deleted.
I think that makes perfect sense: "the right to be forgotten".
Robert
I would not define that as "it does not work". Maybe it does not work as you would expect it.
If you delete an account, what should happen with the issues reported by that account?
Apparently, someone decided that since nobody else interacted with the issue, this issue was yours and yours only, so it should be deleted.
I think that makes perfect sense: "the right to be forgotten".
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu