Re: [Lazarus] Ann: class code creation
On Tue, 08 Mar 2016 08:01:10 -0600, Ondrej Pokornywrote: On 08.03.2016 14:15, Michael Van Canneyt wrote: Well. You take yourself as a reference I think. I don't think Jesus' idea wasn't really serious :) Partly... I was aware there is no support in Lazarus for something like this. Some contra's: 1.) Lazarus IDE doesn't have an API for that. I don't think anybody has time/will to make it - it could be pretty/unnecessarily complex to support it in every IDE dialog. 2.) No Lazarus function is called this way. It doesn't make sense if Code Creation is the only function taking advantage of it. 3.) I don't know any desktop application that works like this (except the TotalCommander mouse right click). (1) is already a reason big enough for me. Indeed. Jesus Reyes A -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On 08.03.2016 15:51, Vojtěch Čihák wrote: Thanks, it's a nice idea. I think that selecting in listbox by arrow keys is annoying and slow. i would rather use RadioGroup where the option can be selected faster by Alt+Key. Done, I did even better. You don't need Alt+Key, just Key. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On 08.03.2016 16:00, Michael Van Canneyt wrote: Great. No more wishes from me then. Good job ! :-) Done in r51859, thanks. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016, Reimar Grabowski wrote: On Tue, 8 Mar 2016 14:15:23 +0100 (CET) Michael Van Canneytwrote: Well. You take yourself as a reference I think. When you called it very confusing... ... you were speaking on behalf of humanity? ... you stated an objective fact? ... you stated your personal opinion and only forgot to make clear that it is an opinion? Reread my mail and you will see it's clearly all my opinion, who shall be the reference if not me. The only fact is that 'long click' is a well known concept which you just happen to not know. Sure, my apologies if I sounded offensive, that was not the intention. Reread your mail and it reads more like it's a fact that it's confusing. Hence why I added the 'for me'. I just wanted to show that it's not confusing for everybody (like your mail sounded), that there are people who would actually prefer Jesus' implementation idea over more short-cuts and that Jesus' did not come up with something strange but with something that's very similar to a concept on a different platform and there known and used by a lot of people. I understand completely. I don't own a smartphone, so 'long click' is not a known concept to me. See, learned something new today. Luckily, I do almost every day :-) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016 14:15:23 +0100 (CET) Michael Van Canneytwrote: > Well. You take yourself as a reference I think. When you called it very confusing... ... you were speaking on behalf of humanity? ... you stated an objective fact? ... you stated your personal opinion and only forgot to make clear that it is an opinion? Reread my mail and you will see it's clearly all my opinion, who shall be the reference if not me. The only fact is that 'long click' is a well known concept which you just happen to not know. Reread your mail and it reads more like it's a fact that it's confusing. Hence why I added the 'for me'. I just wanted to show that it's not confusing for everybody (like your mail sounded), that there are people who would actually prefer Jesus' implementation idea over more short-cuts and that Jesus' did not come up with something strange but with something that's very similar to a concept on a different platform and there known and used by a lot of people. > I don't own a smartphone, so 'long click' is not a known concept to me. See, learned something new today. > I have never met it on a PC. Astonishing. Or actually not. It's not really important anyhow as the simpler to implement method will be used. R. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On 08.03.2016 15:51, Michael Van Canneyt wrote: I introduced the ctrl+shift+x shortcut for the "interactive Code Completion" (class code create). Aha. This was not clear to me ? Just read the very first email from this thread :) So would it be correct to say that ctrl-shift-x = ctrl-shift-c but with dialog if a dialog exists ? Yes, correct! This is the new policy. (That will also mean that ctrl+shift+c on method completion won't show a dialog any more, but place the method to the public section.) Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016, Ondrej Pokorny wrote: On 08.03.2016 15:51, Michael Van Canneyt wrote: I introduced the ctrl+shift+x shortcut for the "interactive Code Completion" (class code create). Aha. This was not clear to me ? Just read the very first email from this thread :) So would it be correct to say that ctrl-shift-x = ctrl-shift-c but with dialog if a dialog exists ? Yes, correct! This is the new policy. (That will also mean that ctrl+shift+c on method completion won't show a dialog any more, but place the method to the public section.) Great. No more wishes from me then. Good job ! :-) Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
Yep, will do. Ondrej On 08.03.2016 15:51, Vojtěch Čihák wrote: Thanks, it's a nice idea. I think that selecting in listbox by arrow keys is annoying and slow. i would rather use RadioGroup where the option can be selected faster by Alt+Key. V. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
Thanks, it's a nice idea. I think that selecting in listbox by arrow keys is annoying and slow. i would rather use RadioGroup where the option can be selected faster by Alt+Key. V. __ Od: Ondrej Pokorny <laza...@kluug.net> Komu: Lazarus <lazarus@lists.lazarus.freepascal.org> Datum: 07.03.2016 21:26 Předmět: [Lazarus] Ann: class code creation I implemented "class code creation" in r51851. I was already tired of creating/copying object variables by hand. The idea is the same as with code creation (ctrl+shift+c), but the variable is created in one of the class section: It is the first version, it probably will need some tuning, so please give feedback. Ondrej -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus> -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016, Ondrej Pokorny wrote: On 08.03.2016 15:07, Mattias Gaertner wrote: ctrl-shift-x -> ctrl-shift-alt-x >ctrl-shift-space -> ctrl-shift-alt-space >etc. > >(btw those are some ugly short-cuts) Code completion is ctrl+shift+c. I thought Michael's X was a typo or placeholder. I introduced the ctrl+shift+x shortcut for the "interactive Code Completion" (class code create). Aha. This was not clear to me ? So would it be correct to say that ctrl-shift-x = ctrl-shift-c but with dialog if a dialog exists ? Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On 08.03.2016 15:20, Mattias Gaertner wrote: For example the interactive completion on a property could give options to add Getter, Setter or add code for an array property. Yes, this is also a valid enhancement. In the dialog there could be an option to create a "property x: Integer read Fx/Getx write Fx/Setx;" instead of pure field "x: Integer". Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On 08.03.2016 15:07, Mattias Gaertner wrote: ctrl-shift-x -> ctrl-shift-alt-x >ctrl-shift-space -> ctrl-shift-alt-space >etc. > >(btw those are some ugly short-cuts) Code completion is ctrl+shift+c. I thought Michael's X was a typo or placeholder. I introduced the ctrl+shift+x shortcut for the "interactive Code Completion" (class code create). Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016 15:01:10 +0100 Ondrej Pokornywrote: >[...]To reduce confusion I can enhance the > dialog with a local/class target combobox - people could than map the > more interactive shortcut to ctrl+shift+c and use only one shortcut for > both class/local target if they want. What do you think? +1 The less interactive should do a common completion, the more interactive shows a dialog to choose. This is easy to remember and can be used for future completions. For example the interactive completion on a property could give options to add Getter, Setter or add code for an array property. > If I create a special shortcut for every option of CodeCreation, they > could easily blow up (like shortcut for add to private, public etc, > maybe more in the future). Yes, that would be stupid. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016 14:05:18 +0100 Reimar Grabowskiwrote: >[...] > > > Then better 2 shortcut keys: > > > ctrl-shift-X = create using default set in options. > > > ctrl-alt-X or ctrl-shift-alt-X = create and force dialog. > > > Or something similar. >[...] > ctrl-shift-x -> ctrl-shift-alt-x > ctrl-shift-space -> ctrl-shift-alt-space > etc. > > (btw those are some ugly short-cuts) Code completion is ctrl+shift+c. I thought Michael's X was a typo or placeholder. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On 08.03.2016 14:15, Michael Van Canneyt wrote: Well. You take yourself as a reference I think. I don't think Jesus' idea wasn't really serious :) Some contra's: 1.) Lazarus IDE doesn't have an API for that. I don't think anybody has time/will to make it - it could be pretty/unnecessarily complex to support it in every IDE dialog. 2.) No Lazarus function is called this way. It doesn't make sense if Code Creation is the only function taking advantage of it. 3.) I don't know any desktop application that works like this (except the TotalCommander mouse right click). (1) is already a reason big enough for me. --- Btw. do you really think that the dialog is so frustrating? You can apply it by just one Enter press. I personally like to know where the things are put. An alternative "no-dialog" shortcut is easy to make, but I still don't know if yet another shortcut brings really some simplification. Formerly, there was 1 shortcut for CodeCreation, now there are 2, do you really want 3 for the same function? On 08.03.2016 10:13, Mattias Gaertner wrote: One for less interactive and one for more interactive. Many code completions can be enhanced with dialogs. Actually this is already done, ctrl+shift+c is the less interactive (therefore it doesn't offer the class option). ctrl+shift+x is the more interactive with more options. To reduce confusion I can enhance the dialog with a local/class target combobox - people could than map the more interactive shortcut to ctrl+shift+c and use only one shortcut for both class/local target if they want. What do you think? If I create a special shortcut for every option of CodeCreation, they could easily blow up (like shortcut for add to private, public etc, maybe more in the future). Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016, Reimar Grabowski wrote: On Tue, 8 Mar 2016 10:13:22 +0100 Mattias Gaertnerwrote: On Tue, 8 Mar 2016 09:49:45 +0100 (CET) Michael Van Canneyt wrote: [...] No, this kind of behaviour is very confusing for me. See, fixed that for you. Because at least I and Jesus do not think so. It is common behavior on touch devices ('long click'). Give some visual clue (a little (animated) icon on the identifier when the key combination is held for example), document it and you are good to go. On this and the fpc list it is often said that lazarus/fpc are tools for programmers and a little more can be expected of them than of the general user. 'Long click' is a well known and often used UI concept, so you should be able to transfer your knowledge of the virtual keyboard of your phone to the real keyboard in front of your monitor. Well. You take yourself as a reference I think. I don't own a smartphone, so 'long click' is not a known concept to me. I have never met it on a PC. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016 10:13:22 +0100 Mattias Gaertnerwrote: > On Tue, 8 Mar 2016 09:49:45 +0100 (CET) > Michael Van Canneyt wrote: > > >[...] > > No, this kind of behaviour is very confusing for me. See, fixed that for you. Because at least I and Jesus do not think so. It is common behavior on touch devices ('long click'). Give some visual clue (a little (animated) icon on the identifier when the key combination is held for example), document it and you are good to go. On this and the fpc list it is often said that lazarus/fpc are tools for programmers and a little more can be expected of them than of the general user. 'Long click' is a well known and often used UI concept, so you should be able to transfer your knowledge of the virtual keyboard of your phone to the real keyboard in front of your monitor. > > Then better 2 shortcut keys: > > ctrl-shift-X = create using default set in options. > > ctrl-alt-X or ctrl-shift-alt-X = create and force dialog. > > Or something similar. > > +1 -1 > One for less interactive and one for more interactive. > Many code completions can be enhanced with dialogs. Then these short-cuts must follow a general rule or it just gets overwhelming. For example always 'alt' as additional key: ctrl-shift-x -> ctrl-shift-alt-x ctrl-shift-space -> ctrl-shift-alt-space etc. (btw those are some ugly short-cuts) > Or a flag button (e.g. speedbutton) to enable/disable the interactivity. Which must be easy to enable and disable by keyboard and even then it's a hassle if you have to switch it often. I like Jesus' idea the most. The same short-cut for the same function is very consistent. It is a well known UI concept. Switching IDEs often it is always better for me to have to memorize less and not more short-cuts. Lazarus already has quite a lot of keyboard-short-cuts. You could also implement a keyboard-short-cut 'double click' to get to the dialog and 'single click' to complete directly (or the other way round) but I like the 'long click' more and this would most likely be also deemed confusing. R. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Tue, 8 Mar 2016 09:49:45 +0100 (CET) Michael Van Canneytwrote: >[...] > No, this kind of behaviour is very confusing. Then better 2 shortcut keys: > ctrl-shift-X = create using default set in options. > ctrl-alt-X or ctrl-shift-alt-X = create and force dialog. > Or something similar. +1 One for less interactive and one for more interactive. Many code completions can be enhanced with dialogs. Or a flag button (e.g. speedbutton) to enable/disable the interactivity. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Mon, 7 Mar 2016, Jesus Reyes A. wrote: En Mon, 07 Mar 2016 21:21:03 -0600, Ondrej Pokornyescribió: I don't think this is possible or reasonable. On 08.03.2016 2:39, Dmitry Boyarintsev wrote: procedure TClass.Test(y: integer); begin x private|:= y; end; One problem is that CodeTools need valid syntax in front of y to evaluate the type of y correctly (the type that x gets). Eventually people will know the dialog well, so selecting the needed item in the dialog might be painful. Then we should do some kind of fast select possibility in the dialog. From my point of view, typing "x private" is more paintful than writing just "x" and then selecting the section with key up/down from the dialog. If you add only private variables, you can make it the default choice (in Options->Code tools->Code creation) and then the dialog doesn't pop-up. Ondrej Some crazy idea: Detect the shortcut being pressed and then start a timer, if the user releases the shortcut before the timer triggers, then the user wants to use the previous selection (in this case the private section for example) and then no dialog is needed, if there is no previous selection or the timer triggers then show the dialog. The timer interval would need to be a setting so it can be adjusted by the end user. :) No, this kind of behaviour is very confusing. Then better 2 shortcut keys: ctrl-shift-X = create using default set in options. ctrl-alt-X or ctrl-shift-alt-X = create and force dialog. Or something similar. Michael.-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
En Mon, 07 Mar 2016 21:21:03 -0600, Ondrej Pokornyescribió: I don't think this is possible or reasonable. On 08.03.2016 2:39, Dmitry Boyarintsev wrote: procedure TClass.Test(y: integer); begin x private|:= y; end; One problem is that CodeTools need valid syntax in front of y to evaluate the type of y correctly (the type that x gets). Eventually people will know the dialog well, so selecting the needed item in the dialog might be painful. Then we should do some kind of fast select possibility in the dialog. From my point of view, typing "x private" is more paintful than writing just "x" and then selecting the section with key up/down from the dialog. If you add only private variables, you can make it the default choice (in Options->Code tools->Code creation) and then the dialog doesn't pop-up. Ondrej Some crazy idea: Detect the shortcut being pressed and then start a timer, if the user releases the shortcut before the timer triggers, then the user wants to use the previous selection (in this case the private section for example) and then no dialog is needed, if there is no previous selection or the timer triggers then show the dialog. The timer interval would need to be a setting so it can be adjusted by the end user. :) Jesus Reyes A. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On 08.03.2016 2:29, Luiz Americo Pereira Camara wrote: In the dialog title, i suggest to replace "variable" by "field" Will do! Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
I don't think this is possible or reasonable. On 08.03.2016 2:39, Dmitry Boyarintsev wrote: procedure TClass.Test(y: integer); begin x private|:= y; end; One problem is that CodeTools need valid syntax in front of y to evaluate the type of y correctly (the type that x gets). Eventually people will know the dialog well, so selecting the needed item in the dialog might be painful. Then we should do some kind of fast select possibility in the dialog. From my point of view, typing "x private" is more paintful than writing just "x" and then selecting the section with key up/down from the dialog. If you add only private variables, you can make it the default choice (in Options->Code tools->Code creation) and then the dialog doesn't pop-up. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Mon, Mar 7, 2016 at 3:25 PM, Ondrej Pokornywrote: > I implemented "class code creation" in r51851. I was already tired of > creating/copying object variables by hand. The idea is the same as with > code creation (ctrl+shift+c), but the variable is created in one of the > class section: > > procedure TClass.Test(y: integer); > begin > x| := y; > end; > > how about inline notation. procedure TClass.Test(y: integer); begin x pvt| := y; end; or procedure TClass.Test(y: integer); begin x private|:= y; end; hit ctrl+shift+x type TClass = class private x: Integer; procedure Test(y: integer); end; implementation { TClass } procedure TClass.Test(y: integer); begin x |:= y; end; Eventually people will know the dialog well, so selecting the needed item in the dialog might be painful. As well as adding more items to the dialog (by further IDE improvement) will frustrate users. thanks, Dmitry -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
2016-03-07 17:25 GMT-03:00 Ondrej Pokorny: > > > Hit Ctrl+Shift+X on the undeclared variable x and you get a dialog: > Thanks for the work In the dialog title, i suggest to replace "variable" by "field" Luiz -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Ann: class code creation
On Mon, 7 Mar 2016, Ondrej Pokorny wrote: I implemented "class code creation" in r51851. I was already tired of creating/copying object variables by hand. The idea is the same as with code creation (ctrl+shift+c), but the variable is created in one of the class section: Nice, that will come in handy ! Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Ann: class code creation
I implemented "class code creation" in r51851. I was already tired of creating/copying object variables by hand. The idea is the same as with code creation (ctrl+shift+c), but the variable is created in one of the class section: unit Unit1; {$mode objfpc}{$H+} interface type TClass = class private procedure Test(y: integer); end; implementation { TClass } procedure TClass.Test(y: integer); begin x| := y; end; end. Hit Ctrl+Shift+X on the undeclared variable x and you get a dialog: Select the section and voila, x is declared as private variable: unit Unit1; {$mode objfpc}{$H+} interface type TClass = class private x: Integer; procedure Test(y: integer); end; implementation { TClass } procedure TClass.Test(y: integer); begin x := y; end; end. It is the first version, it probably will need some tuning, so please give feedback. Ondrej -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus