Jump to content

programmerdelphi2k

Members
  • Content Count

    1406
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by programmerdelphi2k

  1. programmerdelphi2k

    Create Form

    you can try this way: var Form1: TForm1; implementation {$R *.dfm} uses Unit2, Unit3; procedure TForm1.Button1Click(Sender: TObject); var FormX: TFormClass; begin FormX := TFormClass(FindClass('TForm2')); // TForm3 if (FormX <> nil) then FormX.Create(nil).ShowModal; end; initialization RegisterClass(TForm2); // needs register the "classes" in somewhere... to use it RegisterClass(TForm3); end.
  2. programmerdelphi2k

    DL a file from the web

    ok NOTE: sometimes I read Raymon Chen... good mind!
  3. programmerdelphi2k

    DL a file from the web

    var MyGetLastErrors: TArray<integer>; ... procedure MyProcedureToCommands... begin // command... MyGetLastErrors := MyGetLastErrors + [GetLastError]; // ... // // command... MyGetLastErrors := MyGetLastErrors + [GetLastError]; end; // ... for var E in MyGetLastErrors do // ... if MyHandle <> INVALID_HANDLE_VALUE then // in case will be = null CloseHandle(MyHandle);
  4. programmerdelphi2k

    No one can help

    one tip: as your problem is just 1 specific record, then this record can be "trucated/corrupted" in your DB then, any try to read it... generate a internal error: like "out of memory" is common in this case!
  5. programmerdelphi2k

    No one can help

    without see your code used is hard for me! I would like see your "unit/form" with your components definitions etc... if possible, your DB file (without any records, just struture)
  6. programmerdelphi2k

    How to open a file in the already running IDE?

    first, "I think" .... is not acceptable on programming! Or, it is, or not! second, using an "asynchronism" here (on message) I think that is complicated, mainly if you are using another thread to do the tasks... how many messages and what ordem it is? what ordem you expect? it's complicated if you dont domains the memory flow! of course, exists many way to do it, but I think that you are going in a complicated scenary! but if works, then, works! in time, I dont know very so much about DDE flow, ok? unfortunatelly, I cannot help so much!
  7. programmerdelphi2k

    No one can help

    my advice: select xxx WHERE fieldx=xxx not use "FILTERS" in "unidirectional mode" // read above after, this read a blob, write and save
  8. programmerdelphi2k

    No one can help

    take care about "memory" usage with working with "TStream" like this!
  9. programmerdelphi2k

    No one can help

    Unidirectional is used to specifics DB that support it! old-Fashion... or for quick access to records info without needs see any others!
  10. programmerdelphi2k

    No one can help

    you record in question is = 60MBytes (text + pictures, etc...)? I think that this is not problem at all for "out of memory" it's necessary more info: it's possible you "upload your UNIT + FORM" in zip file for analise?
  11. programmerdelphi2k

    No one can help

  12. programmerdelphi2k

    No one can help

    FireDAC: The Unidirectional property is synchronized with IsUniDirectional. then, just 1 record on memory! what is seen on screen it's another history!
  13. programmerdelphi2k

    No one can help

    normally, to read or save a BLOB you would use some like this ... better, TStream ... not TMemoryStream! in fact, the BLOB fields (data) are not loaded when in "select'ing", just a BLOB ID is known! now when read your blob then, the "data" will be known!
  14. programmerdelphi2k

    Warnings after Build/Compile

    try "delete" the xxxx.DPROJ file, then, your IDE will create a new file for you! --- note: if you use any config specific, of course, it will be delete too! but you can re-do it!
  15. programmerdelphi2k

    No one can help

    "Description" field: what type on DB and size?
  16. programmerdelphi2k

    No one can help

    hi @limelect can you upLOAD just SQLite DB with NONE-records, just structure?
  17. programmerdelphi2k

    backup and restore database sqllite

    after Android 11, you can not use all folders, only public or from your app install!
  18. programmerdelphi2k

    Using attributes on aliases

    type TMyGUID = TGUID; // your "alias" that way TMyHlpToTGUID = record helper for TGUID function MyFunc: string; end; TMyHlpToTMyGUID = record helper for TMyGUID function MyMyFunc: string; end; procedure TForm1.Button1Click(Sender: TObject); var x: TMyGUID; begin x := TMyGUID.Create('123...'); x.MyMyFunc; // MyMyFunc "hide" MyFunc now... helper to same type-base TGUID! end; { TMyHlpToTGUID } function TMyHlpToTGUID.MyFunc: string; begin result := 'Hello'; end; { TMyHlpToTMyGUID } function TMyHlpToTMyGUID.MyMyFunc: string; begin result := 'World'; end; end. as "TMyGUID" is, in fact, "TGUID" (yet), then your attributes should works in "TGUID" not in "TMyGUID" as showed in your "blog post", the real type is "TGUID", then, you needs works with it, not "TMyGUID"
  19. programmerdelphi2k

    backup and restore database sqllite

    FDSQLiteBackup1.Database := 'c:\db.sdb'; FDSQLiteBackup1.DestDatabase := 'c:\db.backup'; FDSQLiteBackup1.DestMode := smCreate; // <--- FDSQLiteBackup1.Backup;
  20. programmerdelphi2k

    DL a file from the web

    in short: it's a bug without wings, thinking it flies high!
  21. programmerdelphi2k

    TClientDataset gives access violation when open

    when using "TClientDataset" you can needs a "Midas" dll, if you dont compile with MidasLib in your project! program Project1; uses MidasLib, // <--- adding this, you'll dont needs DLL to MIDAS on target PC Forms, Unit1 in 'Unit1.pas' {Form1}; {$R *.res} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end.
  22. programmerdelphi2k

    Custom TListBoxItem Live Bindings Advice

    ok, now I think that understand a little more your question! first, basically, all components in FMX is not data aware, like in VCL (DBEdit, DBGrid, etc...) all is done using LiveBinding tech, or by code! create a LiveBinding by code it's very complicated, but it's possible, of course! basically, you'll use a TAdapterBindSource component to create your "LOAD" data!!! you can use yourself "Class" to read/store your infos, like TPerson ... FName, FLastName, etc...) naturelly, you'll have create your logic to updates, saves, read, etc... now, to create your LiveBinding "to binds controls", it's another history... depend of your "necessity" or "complexity" here, it's a part complicated to "open" this black-box really can needs much code BindSourceDB FMX is your DataSource in VCL! You'll note that there is not code using LiveBinding because it works like a "Observer Pattern", send and receiving messages Regarding the use of "styles", you can either use the "Bitmap Style Designer" (Tools menu) to create your styles, or you can do it all in code (needless to say it will be painful) Basically, the styles mechanism works as a proxy, that is, the property definitions are passed to the final components in a trust relationship, that is, there is compatibility between the object that defined the style and the object that will receive the style. In FMX, a style is not the same thing as a "SKIN" (something purely visual), for example! A style is, firstly, "a behavior" (by having a reaction to a user action), and, secondly, a visual appearance! But it's not something out of this world, however, it can be quite complicated to do everything in code! Be aware that the engine that applies the style, looks for some keywords, and that it cannot be translated into other languages, for example! Ex. the name of an object inside style, must be unique, because it will be the one that will receive the updates.
  23. programmerdelphi2k

    Custom TListBoxItem Live Bindings Advice

    First, you should choice between VCL or FMX frameworks! each one have your propose distinct for generate your GUI, same than the components have a similar appearance, including some properties/methods! VCL to MSWindwos only! = 1 platform basically, this the MSWindows world, then, think in this world! FMX to MSWindows, Linux, macOS, (mobile Android, iOS ) = multiplatform! more flexible components usage! basically, any component can be a container to anothers components! then, you can put a "TImage" in your TListbox item, or TLisView item for example! currently, games are created using this framework, because your caracteristics to draw your graphics on screen of course, a skilled developer will question this point, as a lot can also be done in VCL and third party libraries!!! at general, think that "two frameworks distinct in much aspects", but with similar propose! at general, do mix two propose! after this, you can choice how to show your list? TListBox = vertical arrangement of data, in 1 colum TListView = vertical arrangement of data, in more than 1 column (using property ViewStyle) at general, two components has its indications of use, for example: TListView used used to display a much larger amount of data than TListbox... (now what is "large amount of data", it's up to you to define it) any way, both components are not data aware, that is, they are totally dependent on the "LiveBinding" or any other means that the programmer wants to interact with the data on the screen Now, between TClientDataset and FDMemTable, for sure, FDMemTable it is much more flexible, and the FireDAC framework works practically with any current data source, whether using Database driver, ODBC (for text files, csv, Excell, etc...), you will even find it very easy to use for the pretense of using JSON, although this is not the focus of FireDAC! But there are classes to make the job easier. FDMemTable works natively with XML, JSON, FDS (FireDAC in binary mode) - saving or reading data from a dataset Whether for MSWindows or other platforms, you can choose FireMonkey without fear of making a mistake!
  24. programmerdelphi2k

    Attempt to release mutex not owned by caller

    and me, dont talk with you! ... just these time!
  25. programmerdelphi2k

    Attempt to release mutex not owned by caller

    "TLockGuard = class( TInterfacedObject)" is not a "interface at all", but a obj (type TObject) interfaced (using IInterface as its ref-counter)! then, when creating a new obj based on "TInterfacedObject" class, you'll get a "TObject interfaced", and needs define when destroy it... using "FREE" is the variable was defined as "var X : TLockGuard". Else, if it was defined as "var X : IInterface", then, the refcount into in action! where "nil" will go decrement its ref-counter! implementation {$R *.dfm} type TMyHack = class(TInterfacedObject); type TLockGuard = class(TInterfacedObject) end; var ALock: IInterface; // } TLockGuard; procedure TForm1.FormCreate(Sender: TObject); begin ALock := TLockGuard.Create; // Caption := TMyHack(TInterfacedObject(ALock)).RefCount.ToString; // 1=Interface, 0=class end; initialization ReportMemoryLeaksOnShutdown := true; finalization ALock := nil; // based on a Interface // ALock.Free; // based on a class
×