Jump to content

Martyn Spencer

Members
  • Content Count

    33
  • Joined

  • Last visited

Everything posted by Martyn Spencer

  1. Martyn Spencer

    Converting simple VCL form to FMX

    This is perhaps a slightly naive question, but I would like to convert a very simple form (some checkboxes, edits, memos etc) that only contains VCL controls to an FMX form. I found "Mida Converter" and purchased a license but the developer has been pretty much non-responsive. The software has a registration system that uses non-HTTP/HTTPS ports to handle the process and rather than just shipping a registration code, the process seems to be harder than required. He has not set up the account correctly, so I am unable to complete the activation. So, a refund is now in progress. Long story short, I have not been able to see if it would handle the job. I have a few forms that I could handle by hand, but automation would definitely be preferred. I have a larger project with many forms and many standard controls and if there were a tool to handle most of the UI grunt work for me to worry about code changes, modals etc, it would at least help with the process. Can anyone comment on the way that they handle such simple conversions and whether they have or use a tool that can take a DFM and convert it to an appropriate FMX DFM? Thanks in advance.
  2. Martyn Spencer

    Converting simple VCL form to FMX

  3. Martyn Spencer

    Converting simple VCL form to FMX

    I am purely concerned only with the controls and their layout. It's clear that the frameworks are quite different and I am under no misapprehension that the entire process could be automated, but converting, say, a VCL TEdit, or a VCL TPanel to a corresponding FMX control should be quite possible and that Embarcadero suggested Mida implies that certain elements can be done. My objective is to find out how much (if any) can be automated. Thanks for the comment, though.
  4. Martyn Spencer

    Converting simple VCL form to FMX

    Thanks for the explanation Gustav. I think the approach I am going to take is to create some basic macros to convert property names and work with the DFM files. I have been experimenting and have been able to migrate a relatively simple form by changing property names and removing those that are not directly supported. It's not perfect, but in the absence of anything better, it's probably the route I am going to take. It's genuinely disappointing about Mida Converter. Embarcadero at one point offered it with Delphi for a limited time so I imagine it did some of the grunt-work successfully.
  5. Martyn Spencer

    Converting simple VCL form to FMX

    Fortunately, I wasn't expecting a free ride and full automation, but if there was a tool that could take the basic VCL controls and map properties automatically, it would have been great. I am rapidly coming to the conclusion that it may be better to start from scratch, but I would have been daft to have not asked if there was something that others had found. Thanks for the feedback, though.
  6. Martyn Spencer

    Converting simple VCL form to FMX

    I am aware that there would be coding changes required, but we are talking about some really simple UI designs that naturally I could do by hand. If there were a tool (and Mida is not that tool given the developer's lack of response), it would be great. Thanks for your feedback so far.
  7. 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.
  8. Martyn Spencer

    TFrame and VCL styles [solved]

    Works just fine, thanks 🙂
  9. Martyn Spencer

    TFrame and VCL styles [solved]

    Thanks Uwe. I will give that a go to see if it works.
  10. 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.
  11. 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.
  12. 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.
  13. 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?
  14. 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.
  15. 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.
  16. 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.
  17. 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 🙂
  18. 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
  19. That would make sense. I definitely have a way forward. Thanks for your input, both.
  20. 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.
  21. 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.
  22. Martyn Spencer

    Delphi 10.2 / FireDAC / SQL Server

    Having problems connecting to a SQL server. It used to work fine, but after changes by the database host, I am now having issues. I want to rule out anything I am doing. One major change is that they are now using encryption (which they should have used before). I have the OLE DB Driver for SQL server installed (the most recent version, I believe). The log is shown below: ================================ Connection definition parameters ================================ Database=XXXXXXX User_Name=XXXXXXX Password=XXXXXXX Server=XXXXXXXX Encrypt=Yes ODBCAdvanced=TrustServerCertificate=yes DriverID=MSSQL Pooled=False ================================ FireDAC info ================================ Tool = RAD Studio 10.2 FireDAC = 16.0.0 (Build 88974) Platform = Windows 32 bit Defines = FireDAC_NOLOCALE_META;FireDAC_MONITOR ================================ Client info ================================ Loading driver MSSQL ... Loading odbc32.dll driver manager Creating ODBC environment handle Searching for ODBC driver ... Checking for ODBC driver [SQL SERVER NATIVE CLIENT 11.0] ... Checking for ODBC driver [ODBC DRIVER 13 FOR SQL SERVER] ... Checking for ODBC driver [ODBC DRIVER 11 FOR SQL SERVER] ... Checking for ODBC driver [SQL SERVER NATIVE CLIENT 10.0] ... Checking for ODBC driver [SQL NATIVE CLIENT] ... Checking for ODBC driver [SQL SERVER] ... Found [SQL Server] ================================ Session info ================================ Failed to connect to DBMS ! [FireDAC][Phys][ODBC][Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error
  23. Martyn Spencer

    Delphi 10.2 / FireDAC / SQL Server

    Thanks for the links, Lars. I'll have a read. I do not control the server and I am only pulling a small amount of data, so I don't have a great deal of information. I'll look at what you have posted and find out what I can then post back here with either more info, or how it was solved.
  24. Martyn Spencer

    ICS registration

    I see what I have done. I did not realise that the most recent version included the SSL files (should have read the explanatory text better) and I downloaded the separate (older) SSL files. Thanks for taking the time to clarify.
  25. Martyn Spencer

    ICS registration

    It was downloaded with the distribution from the web site, if I remember correctly.
×