tag:blogger.com,1999:blog-5314745381778741517.post4838873776803951355..comments2018-02-04T03:47:12.541+00:00Comments on LazPlanet: Everything about using 2 forms... or more!Adnan Shameemnoreply@blogger.comBlogger14125tag:blogger.com,1999:blog-5314745381778741517.post-91560219812870853602017-12-24T06:01:04.385+00:002017-12-24T06:01:04.385+00:00@Dwi Ahmad
I am not sure about Delphi. I have nev...@Dwi Ahmad<br /><br />I am not sure about Delphi. I have never used it. But it seems &quot;implementation uses&quot; can be used on Delphi:<br /><a href="https://stackoverflow.com/a/4428714" rel="nofollow">https://stackoverflow.com/a/4428714</a><br /><br />You don&#39;t actually need to include it always. You will only need to include the unit under uses when you need to access any component from that form. Otherwise, you can just skip it.<br /><br />You can also try including the unit in the normal uses clause. This should be ok in normal case, but that causes problems when that other form also &quot;uses&quot; this form.<br /><br />Hope this helps.Adnan Shameemhttps://www.blogger.com/profile/03795435968155667026noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-52993845716256360642017-12-14T23:42:17.955+00:002017-12-14T23:42:17.955+00:00hi, good morning.. it&#39;s morning around here.
I...hi, good morning.. it&#39;s morning around here.<br />I used delphi 7, but unfortunately when I use &quot;implementation uses&quot; my program won&#39;t start and it says Tform1 was missing or incorrect, after I remove the &quot;implementation uses&quot; again, it works..<br />please help me.<br />thanks in advance.Dwi Ahmadhttps://www.blogger.com/profile/08460010690793700842noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-36257835676203296052016-04-07T20:54:25.613+01:002016-04-07T20:54:25.613+01:00Thank u your advice helps alot
Thank u your advice helps alot<br />Unknownhttps://www.blogger.com/profile/08323916878615197259noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-43228032852937275542015-10-13T19:47:31.012+01:002015-10-13T19:47:31.012+01:00Well, it is one of the very confusing topic of Laz...Well, it is one of the very confusing topic of Lazarus. I understand. Let me explain the solution to your problem in detailed words...<br />Start Lazarus.<br />Create a new Application Project (Project-&gt;New Project-&gt;Application-&gt;OK)<br /><br />Now you want to deal with 2 forms. So create one using File-&gt;New Form.<br />Save the project using File-&gt;Save All.<br />Draw a TEdit on Form1 and a TLabel on Form2.<br />Now on Unit1, under its implementation clause add a uses clause:<br /><br /><i>implementation<br /> uses<br /> unit2;<br /></i><br /><br />We would have to show the Form2 because it will not show up by default... Add this code on Form1&#39;s OnShow event... (Object Inspector -&gt; Events -&gt; OnShow -&gt; [...])<br /><br /><i>procedure TForm1.FormShow(Sender: TObject);<br />begin<br /> Form2.Show;<br />end;</i><br /><br />Switch to form view (F12) and double click the TEdit. Then enter the code below:<br /><br /><i>procedure TForm1.Edit1Change(Sender: TObject);<br />begin<br /> Form2.Label1.Caption := Edit1.Text;<br />end;</i><br /><br />Now Run it (F9) and you should have two forms on screen. (You may have to move one form to see the other.) Now write something on form1&#39;s Tedit and you should have what you want. :-)<br /><br />Regards.Adnan Shameemhttps://www.blogger.com/profile/03795435968155667026noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-89973817904813495282015-10-03T15:38:02.675+01:002015-10-03T15:38:02.675+01:00hello.. i want to ask some help.. :-)
i have 2 for...hello.. i want to ask some help.. :-)<br />i have 2 forms. i created Tedit in form1 and Tlabel in form2.. my design is, when i&#39;ll put something in Tedit in form1, i want it to be shown in Tlabel in form2.. how will it happen? pls. give or share some tip or advice.. thanks :-)Unknownhttps://www.blogger.com/profile/07254851735997933671noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-18031106612552851012015-07-14T16:40:06.975+01:002015-07-14T16:40:06.975+01:00@Eddie Bole
Well, to explain this it would take a ...@Eddie Bole<br />Well, to explain this it would take a whole new article. :)<br /><br />I would explain it as much as I can-- <br />Every project you make with Lazarus has a general uses clause at the very beginning of the unit code. You can switch to Code view of any project (F12) and you would see the general uses clause. This clause acts as an &quot;include&quot; function for your project. There are many codes written for you already in Lazarus/Free Pascal. But in order to use them, you&#39;ll have to &quot;include&quot; those code units into your project. For that you&#39;ll have write their name in the USES clause.<br /><br />If you are familiar with C++, you should know that every code in C++ has some include command, such as, #include . iostream.h has all the input and output functions written into it so that you don&#39;t have to. You would then only need to include that file to use those functions in the file. Uses clause in Pascal is just like that. (The only difference being that you don&#39;t have to type in any filename, you just need to write their unit name.)<br /><br />If you create a new Application project in Lazarus (Project-&gt;New Project-&gt;Application-&gt;OK) you would see that Lazarus already &quot;included&quot; some units in its code in the code view (F12). These units are basic Form and Component units. Even the simple ShowMessage() comes from the &quot;Dialogs&quot; unit. You can add different kinds of components (such as a TImage) and Lazarus will add the necessary units in the uses clause.<br /><br />So a pascal code can have a general Uses clause and another Uses clause under the implementation clause. This one is special case but it works the same way. The difference is that, this uses clause cannot be seen by other units. It is just for the current unit.<br /><br />General Uses clause helps you to include a code from another unit. Same happens for the Implementation Uses. We &quot;include&quot; Unit2 to use the components that are declared in Form2. If you go to the code of Unit2 you will see under the Form2 class declaration that there are all the components that you created on the form. Lazarus creates these code lines under the hood. By &quot;including&quot; Unit2, we can use those components in our Unit1 code.<br /><br />For further reading you can see <a href="http://wiki.freepascal.org/Unit" rel="nofollow">this wiki article</a>.<br /><br />Hope I made it clear to you.Adnan Shameemhttps://www.blogger.com/profile/03795435968155667026noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-77836057863063317082015-07-13T03:45:49.219+01:002015-07-13T03:45:49.219+01:00First of all, thanks for the nice tute Adrian.
I&#...First of all, thanks for the nice tute Adrian.<br />I&#39;m still a bit confused about &quot;Uses&quot;. When would you ONLY USE a &quot;Uses&quot; clause? Can you give another example?<br /><br />I understand that to access each form from the other you need to add a &quot;Uses Implementation&quot; clause to prevent a circular reference error.Eddie Bolehttps://www.blogger.com/profile/01703789805498148542noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-54396533460681968222015-04-07T18:15:11.442+01:002015-04-07T18:15:11.442+01:00@stroebel,
(Sorry for late reply. My internet conn...@stroebel,<br />(Sorry for late reply. My internet connection is not so steady lately.)<br />That&#39;s great! Good luck on your book!<br /><br />And yes, you are welcome to write on LazPlanet. If you wish to write interesting and helpful articles or tutorials, you can contact me with the &quot;Contact&quot; page (link can be found at the top navigation).<br /><br />Regards<br />AdnanAdnan Shameemhttps://www.blogger.com/profile/03795435968155667026noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-88021887870245178822015-04-05T12:38:24.252+01:002015-04-05T12:38:24.252+01:00Dude Please send your email so I can email you the...Dude Please send your email so I can email you the zip quickly. And so I have way of contacting you faster!gorhin stroebelhttps://www.blogger.com/profile/04889314177121007933noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-71335000065089332092015-04-05T08:50:53.977+01:002015-04-05T08:50:53.977+01:00I would like to also help with the tutorials
I&#3...I would like to also help with the tutorials <br />I&#39;m 14 Years Old And Work With Delphi 7<br />I Know:<br />Python<br />HTML<br />CSS<br />Java<br /><br />I&#39;m Working On A Book Called:<br />Graphical Programming With Delphi<br />And<br />Delphi Physics<br />+++++++++++++++++++++++++++++++++<br />I Make Videos on Delphi and Java but I never put them on youtube yet<br /><br />So I want to know if I can help here?gorhin stroebelhttps://www.blogger.com/profile/04889314177121007933noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-63249254004494988452015-04-05T06:25:00.941+01:002015-04-05T06:25:00.941+01:00@stroebel,
Happy to see you got new ideas.
Yeah su...@stroebel,<br />Happy to see you got new ideas.<br />Yeah sure. Post a link and I&#39;ll check it out.<br /><br />Regards<br />AdnanAdnan Shameemhttps://www.blogger.com/profile/03795435968155667026noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-89190979192879873632015-04-04T22:56:06.594+01:002015-04-04T22:56:06.594+01:00Hey Their Nice Site I Found Some Awesome Ideas for...Hey Their Nice Site I Found Some Awesome Ideas for features in my Snap Shot App Called (Snap!)<br /><br />I Would Love you to check out my Project Mangorhin stroebelhttps://www.blogger.com/profile/04889314177121007933noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-85642454152242640422015-01-19T17:32:15.820+00:002015-01-19T17:32:15.820+00:00@Tida Tida
Yes, you are right. (Oops!) Thanks for ...@Tida Tida<br />Yes, you are right. (Oops!) Thanks for pointing out the mistake. Great to have a reader like you.<br />The mistake was due to writing it in my busy schedule.<br />The code has been fixed.<br /><br />Sincerely<br />AdnanAdnan Shameemhttps://www.blogger.com/profile/03795435968155667026noreply@blogger.comtag:blogger.com,1999:blog-5314745381778741517.post-63132290777716143592015-01-16T14:52:28.036+00:002015-01-16T14:52:28.036+00:00Accessing Form1 from Form2:
You implemented Unit 1...Accessing Form1 from Form2:<br />You implemented Unit 1 in Unit 1. Shouldn&#39;t Unit 2 be implemented in Unit 1..Tida Tidahttps://www.blogger.com/profile/16252736223889622020noreply@blogger.com