xsharp.eu • Two VS issues
Page 1 of 2

Two VS issues

Posted: Sun Sep 18, 2022 3:50 pm
by ic2
I added a toolbarbutton on a Winforms form and doubleclicked on it.

In C# this would create a click event. This happens in a total random area in the .prg, but that is how VS works.
However, in X# it opens the "code behind" prg but does not create the click event. Is there anything I can do about that?

I also have a small request. If I enter a newline, starting a next method, behind code like this:

Code: Select all

Private Method Somebutton_Click(sender As System.Object, e As System.EventArgs) As Void Strict Class SomeWindow
// Some code
Return Nil
then the Return statements indents. That should not happen, it should stay aligned with the Method statement.

Dick

Two VS issues

Posted: Sun Sep 18, 2022 9:01 pm
by Chris
Hi Dick,

I don't see a "ToolbarButton" control in the windows forms toolbox, which control exactly did you add and how?

Two VS issues

Posted: Mon Sep 19, 2022 10:53 am
by ic2
Hello Chris,


You are right. It is called System.Windows.Forms.Toolstripbutton. I don't know how it's added (I have to ask Kees); there's an existing toolstrip with some buttons and there's a small drop down menu which allows me to add more buttons (or other controls) to it.
Toolstripbutton.jpg
Toolstripbutton.jpg (16.58 KiB) Viewed 669 times
It is indeed remarkable that the "indenting return issue" only occurs when I press <Enter> after a click event method as I posted.

Dick

Two VS issues

Posted: Mon Sep 19, 2022 2:39 pm
by Chris
Hi Dick,

Seems to work fine here, can you please create a sample showing the problem?

Two VS issues

Posted: Mon Sep 19, 2022 8:47 pm
by ic2
Hello Chris,

You actually have one. Open the sample I sent this afternoon for the Zipextensions issue, open Functions.prg, move to the last line 102 where it says Return True , move the cursor to the end of the line and press <Enter>

The Return True in the line above also indents there - where it shouldn't.

Dick

Two VS issues

Posted: Tue Sep 20, 2022 5:16 am
by Chris
Hi Dick,

Oh, I meant about the problem with creating the click event.

About the RETURN, this is as intended, since it is considered an "executable" command, so it gets indented like everything else. On the other hand, if you finish the method with "END METHOD", this should indent below "METHOD"indeed.

.

Two VS issues

Posted: Tue Sep 20, 2022 10:02 pm
by ic2
Hello Chris,

Is there any way to prevent this, like a setting?

I don't need END METHOD. But I want Return statements to align with the METHOD...
I am wasting far to much time during programming to move everything back to where it should be, like the ENDIF (always requiring multiple backspaces).

More than once I start writing my new method in VO. Then at the end I copy it,. all perfectly aligned, in X#.
It would make quite a difference if I needn't do that...

Further I will check if I can modify the sample to show the non created event, and if I can't, to find out why it didn't t work in my life project.

Dick

Two VS issues

Posted: Wed Sep 21, 2022 4:53 am
by Chris
Hi Dick,

I understand you, I don't like indentation working this way either. But even though you and I don't like it this way, still there are probably 100,000s of other developers (VS users) who do prefer it this way apparently, so we can't say much, but we just need to learn to work this way (well, or decide to develop a custom .Net IDE if someone is crazy enough to do it :))

Two VS issues

Posted: Wed Sep 21, 2022 1:45 pm
by ic2
Hello Chris,

But isn't that something which can be set within X#?

In VS in C# (or VO) a return does not indent when I press <Enter>.

I think not it should not indent in X# and I think that could be set to work like that.

Like the endif (which does not indent for the rare, I would say, extremely cases where the users want type a variable starting with endif.

Why can't the user who is so stubborn to use a variable like that not correct the indent instead if the countless times X# users press endif?

I very well realize that you can not influence everything, and sometimes a change is conflicting with some other, equally met, interest but in case of the return and endif I find it highly unlikely that not the vast majority would want it the way I write. And which I would say, could be arranged within X#. Or am I wrong?

Dick

Two VS issues

Posted: Wed Sep 21, 2022 2:54 pm
by Chris
Hi Dick,

It's the way VS is supposed to work, when you hit enter, it aligns the code to the indentation it considers correct. Personally I don't like this at all, but VS works like that and X# is "playing nice" with VS, it is doing things the way VS developers expect them to be done. You could turn indentation completely off, but this way you would have to also manually indent IF and ENDIF...