DelphiTheWorld
Members-
Content Count
10 -
Joined
-
Last visited
Community Reputation
0 NeutralTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Hi the forum, Thanks Patrick for your help and your answer. So finally, I have proceed like that : In the Frame constructor i remove all the objects names of the Frame I memorized the "ComponentIndex" of the object of the Frame I'm interested to interact When I need to use it, I'm casting by the class and use the good index! For example: TLabel(Components[IndexMemorized]).Text := 'MyText'; I'm joining you my final solution package. Again thanks a lot to everybody for your help. TestD3.zip
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Yes but inside the properties how is it the alternative way to proceed to access the component? For example, I design quickly on the Frame visually a component (e.g. : move a TImage on the Frame named imgMyImage). In this case is no more a "variable" inside the class like for the Edit and the Button of the previous example. Following the advice, inside the Frame constructor I will do something like this imgMyImage.Name := ''; But after that inside the setter of my property I will probably not be able to do imgMyImage.Bitmap.LoadFromStream(ResourceStream); because the name is no more accessible not ? I think the only way is to look for the new name of the TImage (perhaps Components[5]) and to cast like that : TImage(Components[5]).Bitmap.LoadFromStream(ResourceStream);. At least I suppose. I will make some tests to check that. But perhaps I'm wrong like for the Stored ? But thanks again to enlight me.
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Hi the fourm, Fresh news today, it works! Thanks a lot for the assistance, I was very desperate. Now I feel so stupid to have been blocked for a so small thing like a property. I think now I will never forget "Stored" property . And thanks also for the explanation it is clearer for me. I tried the trick with Alt + F12 and effectively is multiplying the components for each call to Alt + F12 twice. Yes of course but it was a stupid program to make a very small basic test so I wrote it in a minute. Yes, I saw your webinar and if I remember well you put "Content" for the "Align" of the top Layout. I'm thanking you twice because for the TestD3.bpl package I used the technique you explain on the webinar with the frames. I find it quicker than making all dynamically as I was processing by the past in VCL with Delphi 2010. So now I will work on TestD3 to try to solve the remaining problems. Do you advise me to put the "Name := '';" for all the components inside the constructor of Tframe ? And to access the component like that (TLabel(Components[5]).Text := Value;) for example? I keep you informed and thanks again.
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
And if you have enough energy, here is the real package with the frames with their different published properties that I spoke initially. That the same steps of the previous post. You will see here that you are able to put the components on the form and to change the properties (Error, Open, Orientation, etc.) at design time but when you run the application, changing properties dynamically using a button for example has no effects on the components. TestD3.zip
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Hi, Many thanks Patrick for your valuable answer. Of course it is what I've done in my first package bpl (not mentioned here) but as I have some problems with the real component (only in runtime) I have created a new one with a simple unit to reproduce a "School example" with edit and button. I read carrefully the precious link you gave me and I don't think to misuse the concepts (but perhaps I'm wrong 🙂). In my case, I don't think that "ComponentState" be very useful because the component can do the same thing in designtime or in runtime (but I was aware of that). Better than a long speech I share the source code of the simple example that it doesn't work on my Delphi. You can change the name of the pallet or whatever. Here my steps to reproduce my case: Start Delphi with admin rights (to avoid problems of the .bpl package in the public user, etc.) Open the "PaquetEssai.bpl" Build the package Install the package Open a second Delphi (normally, not with admin rights) Create a new blank FMX application Select in the pallet "Tframe2" (on my case but if you change the name take the good one) and move it in the form Run it Set a text manually inside the Edit Click on the button Surprise! In my case i have nothing but normally I should have a "ShowMessage" with the content of the Edit Tell me if you succeeds in your development environment please. Thanks a lot for your assistance, much appreciated. Essai.zip
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Yes the last one that I have copied is like that but I have tested many combinations. First time I have tried with a real TFrame FMX (.pas + .fmx) but it doesn't work so I have decided to code a simpler case and I tried to make a component derived of TControl, TShape, Trectangle the last one. You have an edit and a button on a trectangle. When you move on the form you see visually the component correctly and when you run it you can write on the edit; click on the button but nothing appears. But in my code you see that I'm calling the showmessage with the content of the edit.
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Hi, Thanks for your help, Yes I tried and effectively the system is no more claiming for same name but in runtime is still doesn't take properties in consideration but it still work at design time. It is crazy. Is there someone with a Delphi 12 Athen version to reproduce the problem to see if ti is the same with another configuration ? Thansk again to all to help me.
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Hi, Thanks for the repy. I tried to add a name for edit and button but it doesn't works better unfortunately But if you create a frame and make right click add to palette without using the .bpl package solution, you can put three times the same frame on a form and it will work even if on the same form you have 3 objects of 3 differents frames with the same name. But if you choose the .bpl package solution it is no more working. But thanks again for your intervention.
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Hello everybody, I met a problem with FMX component. I used a FMX frame to quickly put objects on it, add properties to change images on it and rotate them. In fact a quickly manner to build a component. After that to reuse it I decided to put it on a bpl packaqe and to install it. I open a fresh blank FMX project and move on the form the component (the famous frame) from the palette freshly added by the bpl package. When I'm in design time all the propertiues are well working but when I run it: the different properties are not working if I put on the form 2 times the same component and run it I have a warning telling me that the Layout inside the component as the same name and refuse to continue So I decide to simplify the problem by making a simple component like this: Create a new fresh bpl package Put on it a unit.pas On this unit, I create a class deriving from TRectangle with an edit and a button Add the code for the OnClick event to "ShowMessage" the edit content when i click on the button compile and install the package And the problem ? When I move this new fresh component from the palette on the form and play it the click event is not firing But if I put the unit of the bpl package inside a new FMX project and I launch it directly by code from the form 1 in the oncreate event that works ! I have Delphi 12 Athens on Windows 11 I do not understand why it is not working Here is the code of the unit inside the bpl : unit uniEssai2; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, Fmx.Edit, FMX.Objects; type TFrame2 = class(TRectangle) Edit: TEdit; Button: TButton; procedure Test(Sender: TObject); private public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end; procedure Register; implementation procedure Register; begin RegisterComponents('ZEssai', [TFrame2]); end; { TFrame2 } procedure TFrame2.Test(Sender: TObject); begin ShowMessage(Edit.Text); end; constructor TFrame2.Create(AOwner: TComponent); begin inherited Create(AOwner); Edit := TEdit.Create(Self); Edit.Parent := Self; Edit.Position.X := 8; Edit.Position.Y := 8; Edit.Width := 100; Button := TButton.Create(Self); Button.Parent := Self; Button.Text := 'Click'; Button.Position.X := 8; Button.Position.Y := 40; Button.Width := 60; Button.OnClick := Test; end; destructor TFrame2.Destroy; begin Button.Free; Edit.Free; inherited; end; end. Do you have an idea of what is wrong? The example is very basic I can't understand what is wrong? Thanks for your help.
- 17 replies
-
- fmx component
- onclick not firing
- (and 1 more)
-
Hi everybody, I'm using Delphi 12 on Windows for Desktop applications. I've an FMX project done in single threaded mode (classical without threads) with timers and I have a problem with animation of objects inside frames! The project is structured like that : A main form with 2 timers and 3 layouts (Top, Main, Bottom). 1 - The first timer is in charge to display successively TFrames regarding a process inside the layouts 2 - The second one is in charge of the standby mode management A second form with 5 timers in charge of the communication with a PLC 1 - The 5 timers have different frequencies in order to read different values of the PLC (500 ms, 1s, 1.5s, etc) In the main form, on specifics frames, I've some objects (like TArc or TRectangle, etc.) that are animated by using TFloatAnimation. My problem is that these animations are lagging. Trying to analyse the problem I made a try without timers and it seems to work smoothly but it is hard to conclude if it is only the timers! I would like to create some threads to eliminate the timers and my idea is to create one thread by frequency of reading. But when I will call the method to read from the "Execute" function of the thread, the method called will be located inside the second form in a specific class (but the method is not located in a visual component of the FMX library). So my questions are: Should I use "Synchronize" even if the method called is not a visual component ? I'm afraid of the fact that it could slow down the application as before by the timers if each thread is all the time Synchronizing to make the different read methods calls! To replace the 2 timers of the main thread, I imagined the use of 2 more threads to send events to the main form to let it know when it is needed to change of frame or going in standby mode. Is there a good idea? Is there really the good approach? I'm a little bit lost never stopping to think to do it in the better way. Many thanks to all in advance for your contributions.
- 3 replies
-
- lag
- multithreading
-
(and 4 more)
Tagged with: