Recent

Author Topic: How the Object Inspector, FormDesign, and Editor relate?  (Read 5896 times)

Elmug

  • Hero Member
  • *****
  • Posts: 849
How the Object Inspector, FormDesign, and Editor relate?
« on: July 28, 2011, 10:55:53 am »
The Subject is not meant to be a generic question.

Rather, it is specific as follows:

1. When I DOUBLE-click on a component (say a TEdit), automatically  a Procedure skeleton is created in the editor; the procedure is given a Name; and am passed to the Editor, to complete the Procedure.

2. But the Component that was double-clicked and have VARIOUS possible Events. Yet the IDE chooses, perhaps the most likely one to 'own' the procedure, and it even names it partially to that Event.

3. So, if I don't want that Procedure to be associated with the Component, I simply remove the  procedure's name from the Component Event choices. And I suppose nothing is hurt if the procedure is left in the Editor. Or, I can delete all references to this created skeleton, including the created declaration, and all this is correct? Is this true categorically?

4. Therefore, If I for instance want to relate a procedure to another of the properties of the TEdit, for example OnMouseEnter, I really can't create it by double-clicking ot the Form on the component. Is this Correct?

5. Hence, would then the right way be for me to create the Procedure declaration by hand, then make a skeleton of the procedure, and THEN go to the Object Inspector and in the Events, put the name of the Procedure that I sketch there, without even having to touch the Form being designed? Is this correct?

6. Now after this, if I were to double Click, at the Form, to the same TEdit which already has a procedure associated as I did, by hand, and I double Click the component, then what will happen is a NEW skeleton of a new procedure would be created, rather than the usual "double clicking on a component takes me to its procedure"..Then in this case this would not be true? Is this so?

Now, rather than answers to the above each on each, I am rather  seeking some brief guideance on how to aproach this. For instance, should I rather not ever double click on a forms component, but rather me do everything by hand, when I want to create Procedures and associate them with components?

Sorry for the length of this, but I felt like I rather do the effort in writing in the hope it leads to short explanations by whoever (please) can briefly explain or clarify or correct what I've gathered so far.

Thanks!
« Last Edit: July 29, 2011, 01:13:06 am by Elmug »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: How the Object Inspector, FormDesign, and Editor relate?
« Reply #1 on: July 28, 2011, 11:32:23 am »
2. But the Component that was double-clicked and have VARIOUS possible Events. Yet the IDE chooses, perhaps the most likely one to 'own' the procedure, and it even names it partially to that Event.

The IDE does not decide alone which property to choose, this is defined by the "Component Editor" installed in the IDE. The process of creating a "Component Editor" is explained in the Lazarus book. I don't know if we have wiki docs about this yet.

Quote
4. Therefore, If I for instance want to relate a procedure to another of the properties of the TEdit, for example OnMouseEnter, I really can't create it by double-clicking ot the Form on the component. Is this Correct?

5. Hence, would then the right way be for me to create the Procedure declaration by hand, then make a skeleton of the procedure, and THEN go to the Object Inspector and in the Events, put the name of the Procedure that I sketch there, without even having to touch the Form being designed? Is this correct?

There is no "correct" way in this case. Both methods are correct, it's more a question of efficiency.

To install a new event handler the most efficient way is to do this:

1> Click on the component in the form designer
2> In the Object Inspector, open the Events tab
3> Double click the event that you want to install a new event handler for. Now the skeleton of the code will be automatically created.

Writing the code by hand is also correct.

Quote
6. Now after this, if I were to double Click, at the Form, to the same TEdit which already has a procedure associated as I did, by hand, and I double Click the component, then what will happen is a NEW skeleton of a new procedure would be created, rather than the usual "double clicking on a component takes me to its procedure"..Then in this case this would not be true? Is this so?

Double clicking a component which already has a event handler installed for it's default property will take you to the event handler. You probably didn't connect your event handler to the Component. Just writing a method which happens to have a name that looks like one of the auto-created event handlers doesn't do anything. You can use any name for event handlers. What really connects a event handler to a component is going to the Object Inspector with the component selected, going to the Events tab and selecting a event handler from the combo box.

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: How the Object Inspector, FormDesign, and Editor relate?
« Reply #2 on: July 28, 2011, 11:42:54 am »
Hi and THANK YOU so much for this great explanation and your sharing of such in depth know-how and detail, Felipe.

It's now clear to me, now how the 'decission is made' since no you explain what I never have used yet: the Component Editor.

I will, first chance, explore it, although off hand I kind of feel I shouldn't yet try to use it.

I think I am for now, with your explanation, of doing some combination of double-click then Automatic creation, then I can global edit/replace the name to suit the real need, and then make sure the right procedure name is in the right components and with the new name.

I think I got it.

Thanks again.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: [RESOLVED] How the Object Inspector, FormDesign, and Editor relate?
« Reply #4 on: July 29, 2011, 01:12:48 am »
Thank you Felipe, for your most valuable efforts in the upkeeping of Lazarus and your helping the community.

I do have one more question, related to the subject:

1. Now, if I don't want to risk the creation of skeleton procedures by double clicking on components to be taken to the procedure in the source code, and in particular when the project grows and gets some complexity, is there a facility whereby Lazarus can show a list of the Procedures that are being used and which components  and which of its properties call them?

2. Now if I create a procedure entirely by hand, or function, and does not directly list in a property, is there also some way to list those properties and where they get called from in the code?

Thanks!

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: How the Object Inspector, FormDesign, and Editor relate?
« Reply #5 on: July 29, 2011, 01:37:17 am »
Try this: Lazarus Main Menu -> View -> Code Explorer
It will display tool window with all components and methods.
Is it what you need ?
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: How the Object Inspector, FormDesign, and Editor relate?
« Reply #6 on: July 29, 2011, 02:04:27 am »
Thanks Blaazen,

I went and opened the Code Inspector (first time), and it looks useful, but it is vast and will take me a while to learn from it.

Off hand, though, I did see some legends in the trees that have the words "Invalid Descriptor (14)". What would this mean? The project compiles and runs fine, though.

I feel these facilities must be very onerous to document and mantain, though, is there any webpage link on the Code Inspector basics?

Thanks.

 

TinyPortal © 2005-2018