Jump to content

Martyn Spencer

Members
  • Content Count

    27
  • Joined

  • Last visited

Community Reputation

0 Neutral

Technical Information

  • Delphi-Version
    Delphi 10.2 Tokyo

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Martyn Spencer

    TFrame and VCL styles [solved]

    Works just fine, thanks 🙂
  2. Martyn Spencer

    TFrame and VCL styles [solved]

    Thanks Uwe. I will give that a go to see if it works.
  3. Martyn Spencer

    TFrame and VCL styles [solved]

    Thanks Anders. I have seen their skinning controls and they do seem better than the VCL themes (imo). I am having trouble finding something that offers consistently reliable and attractive themes, but that's probably not for this thread. Appreciate you taking the time to respond.
  4. Martyn Spencer

    TFrame and VCL styles [solved]

    Do you use a different styling system at all? I ask because I generally think that VCL styles look pretty darned ugly in most instances.
  5. Martyn Spencer

    TFrame and VCL styles [solved]

    Hi Anders. I did do a search before posting - I always do. I found some links that should allow the frame background to be transparent, but this simply caused there to be corrupted graphics where the frame background should be. Setting ParentBackground to True has no effect. The TFrame picks up the background that's set at design time and ignores the theme selection. One thing I have not tried is setting ParentBackground and attempting the use of transparency, so I'll give this a go.
  6. Martyn Spencer

    TFrame and VCL styles [solved]

    I been working on a VCL styled application developed initially by someone else and have just started using TFrames to rationalise some of the UI. It would appear that TFrames do not support VCL styles. Is this so? The main frame background appears to be rendered in whatever colour is set as the TFrame "Color" property. I am using Delphi 10.2.
  7. I rarely use Quickreport, preferring other report writers. I have to change an existing report so would appreciate any assistance. In a Quickreport detail band, I have a "description" TQRDBText and below this there is a "notes" TQRDBText. The "description" field is set to auto-stretch. How do I ensure that the top of the "notes" field shifts relative to the "description" field's height and will the detail band automatically increase its height based on changes to the positions and heights of these fields?
  8. Martyn Spencer

    FireDAC Postgresql performance vs ADO SQL/Server performance

    Hi both. Thanks for your comments. It would appear that based on the settings identified, the grids are fetching all data so that the user can manipulate it based on the various grid functions (sorting, filtering etc). To answer the first question that @Attila Kovacs raises, 90+% of the time, the users view the top 10-20 rows in any given grid, but the original system design fetches anything from 2-10K records back "in case" the user wants to start applying filtering etc. This is not a work flow that I feel works well with any client/server system and would typically change the system so that it fetches relevant data based on pre-specified conditions and in the first instance only fetches records that are in view, with appropriate pagination. So, in reply, I would say that unless the user has specified any custom sorting, filtering etc, it would have been good to carry out just a partial fetch. Ultimately, I will be replacing these grids so I am looking for a short-term "fix". It looks as though all records are fetched. I am concerned with the initial fetch and was hoping to reduce the quantity of data. I was further hoping that filtering and sorting would result in modifications to the underlying query, rather than relying on a complete database fetch then client-based sorting/filtering. I think this is answered by what @Alexander Elagin suggests, I could try the "server mode" and see if this works more efficiently without restricting the user. I am asking what the nearest equivalent to ADO is with FireDAC, so am not sure. The default is fmAll, which clearly fetches everything. I believe that there is an on demand setting, but am not sure how well it works with the DevExpress grids. I am looking for the best option to return only visible records unless the user starts filtering or sorting. I appreciate that this may reduce functionality (as suggested above). Yes and testing demonstrates that this is not the issue. It really does appear to be the quantity of data returned by the initial fetch. I also note that when there are master detail relationships, ADO performance does seem to be better than FireDAC for some reason, even given that the ADO/SQL server based tables have no indexes and the Postgresql tables do (and are being used). Differences in the database engines, based on testing, do not appear to account for this. It just seems as though FireDAC has a greater overhead. It was monitoring that highlighted the number of fetches being made by FireDAC. I do not know of an equivalent way of monitoring ADO so any suggestions would be welcome.
  9. My experience with SQL server is very limited and I generally use Postgresql or Oracle with very good results. I am part way through a project for a client where the existing system uses SQL server/ADO and I am moving to a Postgresql database and FireDAC. The system was created by a different developer and his approach was very different to mine. Having replaced old dynamically created queries with appropriate parametrised and more optimal queries, I find that the performance is not what I would expect. The existing SQL server database has a pretty poor design and no indexes. The Postgresql database is better designed, has appropriate indexes, and when accessed natively offers better performance to running equivalent queries on the SQL server database. With this in mind, I do not think that the issue is related to server performance, or the connection to the servers. The existing system makes extensive use of DevExpress tables and relies heavily on filtering provided by the grids. I generally do not work this way, preferring to provide more tailored functions depending on the specific work flow, etc. I will start by saying I think that the root of the problem is related to the amount of data being fetched from the database, potentially including metadata retrieval. Both databases are operating in a data centre and accessed over the Internet. This is not my preference, but it does demonstrate a significant performance difference between the two systems. Running against a local database shows little difference between the two. Experience tells me that the ADO based system is probably fetching records on demand, whereas I think FireDAC is fetching all rows and possibly metadata as well. Having read the FireDAC documentation, it does appear that I have more control but I would be interested in what settings would give comparative performance to the ADO based system, if any. My ideal is to only fetch data when the user pages through a grid. In the long-term, this will be less of a problem because I will be more specific in my queries, but I have a transitionary period where I would like to allow the users to make use of the existing grids with the lowest possible performance penalty.
  10. Thanks for the extensive explanation, David. Fortunately I am aware of all that you describe and it is a good "understanding check" for me. I appreciate you taking the time to write it. All very useful info. I am working on a system that was written by a Delphi developer who clearly did not understand encapsulation and was quite happy to write code wherever the fancy took him. I still am quite happy that my question was answered before 🙂
  11. Hi David, Primarily I was looking to confirm my understanding of how the process worked internally. Your comment is in line with my findings and is pretty much how I handle things, in that if I create form A, with data module B, if B is created and owned by A, the data source fix-ups seem to be consistently applied and I don't observe any issues. Having said that, even though it always seemed to work, I was interested in how other developers handled the situation in case there was something I was missing. From what I read above, I think my understanding is OK. In the situation that you mention in your third paragraph, where a single DM may be shared by a form and maybe a popup that is generated by that form, there are problems and it requires the data module name to be as per what is specified in the designer. Some situations really don't merit a data module specific to the popup and it is here where I wanted to streamline the process of assigning controls to data sources. My reason for posing the question in the first place was that I took over maintenance of an existing program and really did not like how the original programmer worked and was trying to move more towards the methods that I currently use (and work). As part of this process, I thought it prudent to confirm my understanding of the process. Hope that provides more detail for you. I do actually think that my question has now been answered, and whilst I am interested in any discussion that arises from this, please don't feel the need to explain much more to me, as I think I am OK now. Best wishes, Martyn
  12. That would make sense. I definitely have a way forward. Thanks for your input, both.
  13. Thanks Uwe. I have found that if I create the associated data module instance on form creation, and set the owner correctly (this may be incidental and not important), the linkages work. I guess this is because the streaming of the form has not yet been initiated. I think I can work with what you gave me. Appreciated.
  14. Thanks Lars. This is a relatively simple CRUD application and in need of some tidying, rework, but not a major rewrite. I was hoping to learn a little about the internals so that I could manage the re-mapping using some generic code, if possible. What I have currently does work, but it feels like I am abusing the way that it is "meant to work". I generally prefer to avoid this as relying upon automatic behaviour that I cannot predict or control is prone to breaking without apparent reason. Your approach does sound interesting. In more recent apps, I have done something similar, in that the UI comprises basic dumb controls and I add the persistency as required. For new applications, I probably should look into some ORM frameworks, but I am a little unhappy to rely upon automated SQL generation in most instances. I am still trying to find where Delphi replaces component references. I think it could well be at the streaming stage.
  15. This is a bit of a general question and I may not be wording it particularly well. It's also pretty fundamental and in my time using Delphi, I have seen a number of approaches and I am just wondering what the general consensus is. I hope my explanation is clear enough. Let's take a simple example. Form class TfA, has a data aware control ctrl1. There is a data module class TdmB with a data source ds1 linked to a query q1. I want to allow multiple instances of TfA, each with it's own data module instance of TdmB. In of itself, this is really straightforward. I can create multiple instances of TfA and TfA can be responsible for creating its own instance of TdmB and the data source for ctrl1 can be set in code to the instance of TdmB's ds1. This seems to be how some programmers do it. With anything other than a simple form, this becomes a bit of a headache. I appreciate that some people would argue that the data source should be placed on TfA, not in TdmB. In fact, doing this could well simplify the process I am asking about, but I personally have a loathing for too many non-visual controls on a form (I know they can be hidden) and I prefer to see data sources and data sets on data modules. Delphi's documentation suggests that it is OK to work this way. When using the standard Delphi approach, the form designer creates an instance variable for form TfA (fA) and an instance variable for data module TdmB (dmB). When designing TfA, I can simply set the data source and field name for ctrl1 (dmB.ds1) and when the application runs, fA and dmB are auto-created. Delphi automatically handles the correct assignment. How is this handled internally by Delphi? Is it each data aware control that is responsible for picking up the appropriate data source? If not, does the form do it, or is it the data module? Is it the data link that forms part of a data aware control that handles it? The way that I have done this in the past (it works, but it could be considered rather ugly) is to remove Delphi's automatically defined instance variable for the form and data module. In the form class code, I create an instance of the data module, using the form as the owner. When the data module class is created, Delphi appears to automatically handle mapping of the control data sources and I then change the data module component name. This then means that when the next data module instance is created, it can use the default component name and mapping again appears to work correctly. This appears to work well, but I would very much like to be able to say to an existing form, that it should use a specific instance of a data module, on occasion. This may be, for example, if TfA creates a form TfB, which for simplicity's sake will use the data module that TfA created. TfB may be created some time after the TdmB instance has been created (and therefore renamed), so I do not think that the mapping is automatic. I appreciate that I could create an instance of TfB before renaming the data module, or I could temporarily rename it back, but this seems very messy. I am interested in how others do this. If anyone knows of a good reference source for best practices in this instance, it would be very helpful.
×