Tips you need to know. lazarus / 13-General ---------------------------------------------------------------------- Fred vS · 2013-04-14 19:23 In a recent post i noted :  Quote   In case you're not sure, ctrl+click the function name. It will bring you to the containing unit Wahouw, i did not know that tip  . Does it exists a wiki-tips who explains the indispensable short-cut to know ? ---------------------------------------------------------------------- Martin_fr · 2013-04-14 19:29 Read http://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools http://wiki.lazarus.freepascal.org/New_IDE_features_since ---------------------------------------------------------------------- Avishai · 2013-04-14 20:07 From the function declaration you can right-click on it and select 'Find/Procedure Jump' and it will take you to the procedure/function. ---------------------------------------------------------------------- Fred vS · 2013-04-14 20:12 @ Martin_Fr : many thanks. Those shortcut-tip are a treasure that deserves to be shown. In my opinion they are too hidden. I want to be positive and constructive, so i propose to add a wiki : The Top 10 tips you need to know. And because im a democrat, could you, Lazarus users, give the tips you use mostly and that you want to see in the : The Top 10 tips you need to know. Many thanks. ---------------------------------------------------------------------- Leledumbo · 2013-04-15 13:36 QuoteI want to be positive and constructive, so i propose to add a wiki : The Top 10 tips you need to know. And because im a democrat, could you, Lazarus users, give the tips you use mostly and that you want to see in the : The Top 10 tips you need to know.10 is not enough dude... ---------------------------------------------------------------------- BigChimp · 2013-04-15 14:50 Once again, my standard advice: knock yourself out and create a 10 tips wiki page (as long as you link to the relevant wiki pages/docs, which would be very valuable). However, given the limited number of replies to your invitation in this thread I think you might be the only one contributing to the stuff.... Glad to be proven wrong though ---------------------------------------------------------------------- CaptBill · 2013-04-15 16:02 Quote from: Fred vS on April 14, 2013, 09:23:36 pmIn a recent post i noted :  Quote   In case you're not sure, ctrl+click the function name. It will bring you to the containing unit Wahouw, i did not know that tip  . Does it exists a wiki-tips who explains the indispensable short-cut to know ? You are absolutely right. There are indeed, some simple things that are easily missed that could go a long,long way, if learned early on. This list is in fact very short too, when it come to starting out with Lazarus. A well done '20 minute hands on tour' video where you are following along and witnessing the power of the code editor features, first hand, could set you up for that 'aha' moment where you see the real power with Lazarus. Once you have tasted, first hand, where else are you going to go to get that in a programming language? Nowhere, right? There definitely needs to be a teaching tool that forces you to work with some of the more basic things like this. It should be some real simple exercises that hammer some of the basic simple things that, unfortunately, you look back saying "man, wish I saw that years ago". These are the things that make Lazarus so much fun too. When you are doing things right it feels almost like you are 'helped' along like with 'training wheels' almost. If you focus, early on, with these simple features available, you can't help but get 'hooked' on Lazarus. Unfortunately Lazarus/Fpc has just so many good features that some of the most basic like these are easily lost in it all. The code editor really is one of the most awesome features of Lazarus. If you really use it to it's potential it really does wonders for simplifying things. It keeps you 'on the tracks' so to speak. You are right about need more emphasis placed early on. In fact this is exactly all one really needs to be mastering, very first thing, if you intend to attempt anything OOP for sure. I actually thing that by simply forcing yourself though a 20 minute set of coding exercises (video?) could set you up, and advance a person over that 'oop bump' in a big,big way. That plus that is all you need to get 'hooked' or 'see the light' concerning Lazarus, I believe. This is how you 'pre-debug' in design time, good for when you add something to your uses clause, you can quickly test integrity making sure it sees all your units correctly. Also, something really cool, is to use the ctrl AND space bar for this purpose. This extends the concept into the next level of scope, extending the same functionality down to YOUR code/classes, dynamically adding you classes/etc to the dropdowns. This is where it really helps you, when you want  to know if all your 'scoping' is correct. To check something just type it and add a period and ctrl/spacebar. You will know if you 'scoped' it right if the drop down appears or not. Quick and simple. Definitely something good to teach to newbies like me. Thats the trickiest part of Laz/Pascal, keeping the 'structural nature' separated from the 'procedural nature' of most peoples approach.  Also, to round it all out, use the 'code explorer' in the mix and get the 'tree view' of your code. You get that consolidated view. Plus is reveals if your 'structure' is correctly defined. It will reveal the same as the ctrl/spacebar lots of times. Make sure it is refreshed though. Here is my 'minimalist Lazarus desktop'. This ,for me, helps to see the big picture in a clearer manner. 1)The code editor window gets precedence. It is, I believe, the the most overlooked feature indeed. A person could fall in love with Lazarus/fpc right there alone it's so good, am I right? 2)Graphical elements should only be ones that are always relevant, and a 'tree view' is always very relevant when trying to wrap your senses around OOP. Enter the 'code explorer'. 3)Gain extra real estate by dragging closed the 'components pallet' at top and the 'debug output' at the bottom. Drag them open when the are needed. 4)Let your forms float free. Close down the 'object explorer' if not directly dealing with form design. ---------------------------------------------------------------------- CaptBill · 2013-04-15 17:53 I would like to add one more thing that I found very surprising. By extending this very thinking, using the little 'gems' like these, you can easily jump into more advanced concepts even on accident if you use the little tricks available like these...it also extends down INTO your classes structure so you can have classes within classes or even, records within a class. I stumbled on this using some example code I found displaying the new 'advanced records' being implemented. It would seem like this would make things more complicated,but I found, that it actually helps you to understand it better. Paste this into a unit and look at the 'code explorer' view. Code: [Select]unit Unit2; {$mode objfpc}{$H+} {$modeswitch advancedrecords} interface uses   Classes, SysUtils; type TMyRecord = record public type   TMyEnum = (meOne, meTwo);   TMyInnerRecord = record   private     fMyVar: Integer;   public     procedure RandomNumber;   public     property MyVar: Integer read fMyVar write fMyVar;   end; private   fMyEnum: TMyEnum;   fMyInnerRecord: TMyInnerRecord; public   procedure ChangeItUp; public   property MyEnum: TMyEnum read fMyEnum write fMyEnum;   property MyInnerRecord: TMyInnerRecord read fMyInnerRecord write fMyInnerRecord; end; (...) procedure TMyRecord.TMyInnerRecord.RandomNumber; begin   Randomize;   MyVar := Random(100); end; procedure TMyRecord.ChangeItUp; begin   MyEnum := meTwo; end; end.    When I look back, I feel as though what I assumed would add more complexity, actually helps me to understand the oop side of things. Instead of being a "little bit more complex" you are actually starting to "see" the OOP start to 'manifest to your brain'. It actually helps to make it much simpler, almost like defining boundaries/indexing so that my brain can better follow along. It does mean, if you subclass a class in a class, you must do more typing with the dot notation (classouter.classInner.somefunction(1)), which you might find ugly/bothersome/unnecessary but let's consider something...doing this opens up an opportunity to be set up to do compounding of your components. By that I mean having say, a checkbox and a text edit component within a tpanel. It's a simple trick now to simply ripple the necessary function calls up to the tpanel level, don't address the internal visual elements directly...use only those provided on the tpanel, applying the same encapsulation/oop concept set forth in the language of 'OOpascal'  itself. Now you can directly address the contained components without all the messy dot notation plus on top of all that, now the code editor dropdown function list is now 'customized' showing just your interface. Sweeet. This is very important! Now, from here on out your project code has everything at your fingertips with the ctrl/spacebar lookup functionality. Tada! I see what is happening...this way forces you to separate the coding into two distinctive 'phases' ,if you will. You have an initial defining phase where you get the 'hierarchy' of everything established THEN an extra finalization phase where you now want to ripple the interface up to the 'parent class container'. It would seem that this would complicate things but not so fast. This, for me anyway, makes things much simpler once fully understood. It is a more step by step method that might surprise you that it is easy. I think this is a good practice anyway. It is exactly mirroring the whole class/encapsulation concept, mirroring in whatever direction you need to go, imitating the 'pascal way'. Now you are forced to finish off the details of extending the same concept to your class/component. The concept of oop is nice and very appealing, it's actually doing it that is tricky even for veteran programmers, I have noticed. Especially tricky is making components and just the initial 'orientation'. I honestly think that this doesn't have to be. If you get 'tossed right in' and are taught early these seemingly complex things you will be surprised how easy it actually makes getting up and rolling. Gonna need to absorb these things anyway, right? ---------------------------------------------------------------------- Fred vS · 2013-04-15 19:55 Hello everybody  Ok, lets talk about Top 20 @ CaptBill . many thanks for your tips, i gonna study it. I totally agree with you it is a excellent idea to create a video with this top 20 for absolute beginners and others. In the existing wki-page : http://wiki.lazarus.freepascal.org/New_IDE_features_since The creator of that wiki use GIF-animated pictures. The result is perfect. Who is that excellent creator and what did he use to create those wonderful gif-annim ?   I propose also this tip for top 20 : Automatic remover of Unused units. Very useful before final compil, it analyses your code and removes the unused units in uses section : right click on the source editor then Refactoring>Unused units then click on Remove all units ---------------------------------------------------------------------- Martin_fr · 2013-04-15 20:27 Quote from: Fred vS on April 15, 2013, 09:55:26 pmIn the existing wki- page : http://wiki.lazarus.freepascal.org/New_IDE_features_since The creator of that wiki use GIF-animated pictures. The result is perfect. Who is that excellent creator and what did he use to create those wonderful gif-annim ? The images are from several people, but there is a link an top of that page http://wiki.lazarus.freepascal.org/Creating_animated_gifs_for_wiki If you plan on doing that, think about also providing some of the missing images for that wiki.