Jump to content

limelect

Members
  • Content Count

    924
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by limelect

  1. limelect

    On IDE cannot get TABS

    @dummzeuch I will try. However, what I did on each FindComponent I made sure it is not nil and save all components to file with ComponentCount Components.Name this how I found all the names.
  2. Using D10.2.3 function TForm1.GxOtaGetCurrentModule: IOTAModule; var ModuleServices: IOTAModuleServices; begin ModuleServices := BorlandIDEServices as IOTAModuleServices; Assert(Assigned(ModuleServices)); Result := ModuleServices.CurrentModule; end; function TForm1.GxOtaGetFormEditorFromModule(const Module: IOTAModule): IOTAFormEditor; var i: Integer; Editor: IOTAEditor; FormEditor: IOTAFormEditor; begin Result := nil; if not Assigned(Module) then Exit; for i := 0 to Module.GetModuleFileCount - 1 do begin Editor := GxOtaGetFileEditorForModule(Module, i); if Supports(Editor, IOTAFormEditor, FormEditor) then begin Assert(not Assigned(Result)); Result := FormEditor; // In order to assert our assumptions that only one form // is ever associated with a module, do not call Break; here. end; end; end; function TForm1.GxOtaGetFileEditorForModule(Module: IOTAModule; Index: Integer): IOTAEditor; begin Assert(Assigned(Module)); Result := Module.GetModuleFileEditor(Index); end; procedure TForm1.Button2Click(Sender: TObject); var CurrentModule: IOTAModule; CurrentForm: IOTAFormEditor; lComponent: IOTAComponent; begin CurrentModule := GxOtaGetCurrentModule; Assert(Assigned(CurrentModule)); CurrentForm := GxOtaGetFormEditorFromModule(CurrentModule); if CurrentForm.GetSelCount > 0 then lComponent := CurrentForm.GetSelComponent(0) else lComponent := CurrentForm.GetRootComponent; if not lComponent.IsTControl then begin ShowMessage('The Component of Selected is not Container Control!'); exit; end; //CurrentForm.GetSelComponent(0).GetComponentType; Label2.Caption:=lComponent.GetComponentType; <<<<< Tpanel or Tform Label3.Caption:= CurrentForm.FileName; <<< file.dfm // CurrentForm.CreateComponent(lComponent, 'TADOtable', 0, 0, 50, 50); <<<< This is OK ///THIS IS WHERE THE ERROR IS CurrentForm.CreateComponent({CurrentForm.GetSelComponent(0)}lComponent, 'TLabel', 0, 0, 50, 50);<<<< This is an ERROR end; ERROR = Class TLabel is not applicable to this module Any help?
  3. @David Hoyle I modified your software for FMX too and it works as it should be. Thanks again. P.S BPL is easier to work with you do not need to close Delphi and restart or have a second Delphi open. .
  4. @David Hoyle Thanks. As I said you are the EXPERT. I will modify for fmx too. Hopffuly I will succeed .
  5. @Jud My Getit does not work on D10.2.3 it shows error. Is what you showed will work here in my case ? What exactly the above mean?
  6. @David Hoyle I am working with BPL so I do not need to RESTART Delphi after instalation as in DLL. I took a different path for creating so, can you put here your test program so I can try it. May be your path does not do that fmx problem. Thanks P.S I have in my software if not lComponent.IsTControl then begin ShowMessage('The Component of Selected is not Container Control!'); exit; end;
  7. A new problem on fmx. My test is always TLabel. On VCL If the container is Tlabel then the program creates The label on top of a label. Position 0,0. which is OK. If the first label is in the middle of the form the second label will be on top of the first in the middle of the form. Nothing special to say about VCL. ON fmx putting a label on top of another label is a mess. The second label position is thrown at -500 or greater on both axes. Which it does create but put it at a place outside of the 0,0 container. If I RESELECT the form or pannel before creating the component , IT IS OK. I hope I am understood.
  8. @David Hoyle @Remy Lebeau that did it I just added ActivateClassGroup(Vcl.Controls.TControl); @David Hoyle I could not tell everybody how much you help. Thank you very much. And to you @Remy Lebeau that did it thanks. What i did is adding if ExtractFileExt(CurrentForm.FileName)='.dfm' then ActivateClassGroup(VCL.Controls.TControl); So i have it for both Now @David Hoyle when you write the BLOG plz notify me. Thanks. It was a long road for both of us.
  9. @David Hoyle Going to try now
  10. @David Hoyle I did try 'Vcl.StdCtrls.TLable' it did not make any mistake but did not create a component. All the time I am trying with my base instruction CurrentForm.CreateComponent(lComponent, 'Vcl.StdCtrls.TLabel', 0, 0, 50, 50); << this did not make a mistake. however, the list of components is like TLabel and not Vcl.StdCtrls.TLabel. The last few hours I tried from string to class and going from there but did not succeed function FindAnyClass2(const Name: string): TClass; >> this is ok but from here to IOTAComponent; i am again stack. var 😄 TClass; ctx: TRttiContext; typ: TRttiType; begin ctx := TRttiContext.Create; typ := ctx.FindType(Name); if (typ <> nil) and (typ.IsInstance) then c := typ.AsInstance.MetaClassType; result:=c; ctx.Free; end; I really do not have a solution. I am an expert in real-time processes. Making software for big companies but am not an expert in EXPERT.
  11. @David Hoyle Unfortunately I do not understand "fully qualified name". An example of "fully qualified name"? What I get from the IDE is a component name as a string. Is there another way? The successful "CreateComponent" uses a component name, not a string, that needed a USES, which is not good. Ok i read the explanation So what you mean is to go from "TStream" to System.Classes.TStream and then use that?
  12. Thanks, @Remy Lebeau I thought it will be complicated. Do you have an idea why "CreateComponent" does not work on VCL? Is it a Delphi bug?
  13. Thanks, everybody. After trying to solve my problem with ALL "CreateComponent" (tried a few) it seems that I do not have a solution for VCL. I hope maybe @David Hoyle will find a solution? So for my last question for this is it possible to distinguish , when I have a component name as a string, if it is for VCL of FMX. I know that fact from the registry but that not good enough since NOT all components are written there. The components list names are taken from PackageServices := BorlandIDEServices as IOTAPackageServices;
  14. limelect

    Converting simple VCL form to FMX

    Can this be of any help? http://www.innovasolutions.com.au/delphistuf/ADUGVCLtoFMXConv.htm
  15. @David Hoyle You made me think and I just found that 1. It works on FMX 2 I did not do an extensive check but it seems to work with VISUAL and NON VISUAL. So why the difference?
  16. @David Hoyle if I use this IDs.CreateComponent(TComponentClass( Tlabel),GxOtaGetNativeComponent(lComponent),0,0,50,50) ; Tlabel not as a string it needs USES to work. Using TADOtable need USES. But it works. So I tried GetClass instead and it got me back to the ERROR; It seems that the main problem is the difference between VISUAL AND NON VISUAL. Since TADOtable workers in any configuration but Tlabel maks the ERROR 'not applicable to this module' So the question is if not this module then which one. In my case, I use the dfm/pas source Label3.Caption:= CurrentForm.FileName; <<<< DFM CurrentForm is derived from CurrentModule. Label4.Caption:=CurrentModule.FileName; <<<< PAS The objective is to place ANY component on a control be Form, Panel, or else. I did not get to the point of differentiating between VCL and FMX. Right now I am trying only to use VCL. And lastly the original source workers on D7 so there is a difference between the Delphi version although the sources (DesignIntf and more) seem to be the same.
  17. I finally have a solution with the help of GEXPERT @dummzeuch source It says "// If this starts crashing try IDesigner.CreateComponent" So I did var IDs: IDesigner; change create component to ids := (CurrentForm as INTAFormEditor).FormDesigner; if Assigned(IDs) then IDs.CreateComponent(TComponentClass( Tlabel),GxOtaGetNativeComponent(lComponent),0,0,50,50) ; I hop i did OK Any further help will be appritiated For me, it worked on D10.2.3 this is what I needed.
  18. Delphi and Embarcadero. "CurrentForm.CreateComponent" works on D7 !!! it creates the component. Can someone explain why? Is it a bug in Delphi?
  19. I would like to thanks @David Hoyle for his personal communication. It seems that "CurrentForm.CreateComponent" in another variation too give this ERROR "Class TLabel is not applicable to this module". Although the variables are correct. Using TADOtable instead of Tlabel is working. Any idea?
  20. @David Hoyle I did not want to bother you However i will send you the source. I used an old D6 project called ComponentSearch the project called cs very simple. It has a few pas so it is useless to put it here Thanks
  21. limelect

    Debug Expert

    I have an expert I am trying to debug. On the host, I have a second Delphi. I hope all flags are for debugging. While running the Project I get errors like "Socket error 10048" I press Continue. "Could not bind socket". Continue. "Socket error". Continue. "Could not bind socket". Continue. Now I get my second Delphi. Installing the expert give me a working expert with blue points (debug) on the source. Now to my problem. Putting a debug (red line) does nothing. The expert works but does not debug (stop). I made sure (I hope) all flags are on. Any idea why and help.
  22. limelect

    Debug Expert

    @dummzeuch Suddenly it workes. What I did I deleted all files except the DPK and source. Before I had breakpoints ONLY on "the second instance". Now it is OK I did break on the "the first instance". Thanks and when I have any strange problem I DELETE all files except sources and usually it workes. Thanks @dummzeuch and all for the help
  23. limelect

    Debug Expert

    @dummzeuch On the second Delphi, all sources are with blue points. Does it not imply that I run in debug mode.? This is the first thing I made sure I am in debugging.
  24. limelect

    Debug Expert

    @Lars Fosdal Do you think does this affect the debug? Although the source on the second Delphi has blue points (debug).
  25. limelect

    Using Thread

    In an application, I am using Marco Cantu https://blog.marcocantu.com/blog/2014_may_background_delphi_android_threads.html Thread. I have 2 questions 1. I am concerned pressing a button many times does not leave-in memory the last thread or do I have to make sure that before I create a new TThread.CreateAnonymousThread(procedure () that the old one does not exist? 2. On the same program, I would like to use Toast. (Using Notify works). I am trying to put Toast in Synchronize TThread.Synchronize(TThread.CurrentThread, procedure() begin {$IFDEF POSIX} ToastManager1.Toast('Finished Loading Contacts'); // ToastManager1. // FMXToast1.ToastMessage:='aaaaaa'; // FMXToast1.Show(self); // NotifyComplete; {$ENDIF} end); Android gives me a message NO DUPLICATE ALLOWED. So I guess I have to put the TOAST statement outside the thread. Any idea how to? I could put a flag and with timer use it but I do not like the idea.
×