Jump to content

PeterBelow

Members
  • Content Count

    455
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by PeterBelow


  1. All components that have the form as Owner (which includes all components dropped on the form in the IDE designer) are automatically destroyed when the form is destroyed. So your query components are destroyed but whether that automatically releases serverside resources depends on how the component, especially its destructor, is implemented. But a TFDQuery will close the query when it is destroyed, so your scenario is OK.

    • Like 1

  2. One thing may be a problem. Both the cmtx22 and cmtx33 functions use a (global ?) variable cmtx but do not clear it first. So the array elements not set by the functions will have values carried over from previous uses of this variable.

     

    Sorry, but the whole design looks fishy and error prone to me and seems to use plain procedural programming 40 years out of date. You define a large fixed size array type, variables of which will not only waste a lot of memory for elements never used, but you also have no convenient way to figure out from a variable what the dimensions of the actually used part are. In my opinion you should build a TConfusionMatrix class, which internally uses a 2D dynamic array (array of array of extended) to store the values of the matrix. The constructor of the class would take the needed dimension and size the internal array accordingly. You could have additional constructors to build the matrix from your string representation or a 1D array of values, methods to return a string representation, to compare an object of the class to another, properties to return the dimensions of the matrix or to get or set element values. Since the matrix object knows the size of the internal array it would be easy to check report indexing errors and so on.

    • Like 2

  3. Does this project use QuickReports? If so, did you install this package on that machine? The exception class indicates that the error occurs while loading components from a DFM or perhaps a report template but the error message is a bit weird. Perhaps it is worded incorrectly and should say that only one instance of TQuickRep is allowed in this template...


  4. Using Sharemem may give you a common memory manager for host app and dlls, but you still have separate code "instances" for all RTL and VCL stuff you use on both sides, which includes any global variables the units in question may use internally, the Application and Screen objects etc.  If this worked in the past you have simply been lucky :classic_dry:, but your luck appearendly ran out when you switched to the more complex FireDac framework.

     

    The only safe way to share object references between modules is to use packages instead of DLLs. Unfortunately, packages are all or nothing, you have to build host program and your own packages (which replace the DLLs you now use) with packages and deploy all the required run-time packages of the RTL, VCL, and whatever else (e.g. 3rd party stuff) to the user's PCs. Not fun. And if you load packages dynamically better not try to unload them in code as well, that has been a source of hard to track errors due to premature RTL etc. unit finalization in the past (may have been fixed but is hard to verify).

     

    If you want to stick with DLLs you need a different design that shares interface references instead of object references between the modules. Host and DLLs would use a common unit with the interface declarations; all exported functions would use interface references instead of object references. For the classes you now share you would have to write a layer of TInterfacedObject-derived wrappers that implement the interfaces that allow you to safely call methods and access properties od the wrapped objects.


  5. 13 hours ago, robertjohns said:

    Any way to add an option of Opendialog filename path selection in each listview subitem Item similar to below Image

    Screenshot_9.png

    A TListview is not designed to host other controls. Take a look at TControllist, it may be more suited to your requirements. Another option would be a TScrollbox with a number of instances of a custom frame (which are created in code as needed, each representing the data of a suitable object or record).

    • Like 1

  6. 13 hours ago, JohnLM said:

    I am just starting to use the TValueListEditor and found out that there is no wordwrap feature.  

     

    I have text that are longer than I can see and there is no scroll feature.  Actually, there is, but it does not do what I expect it to do as a scroll (left/right), but even so, it would be too cumbersome to utilize. I would much prefer to have the text wordwrapped.

     

    Is there a way I can easily add a custom wordwrap to it?

     

    Not easily, no. You would have to draw the text yourself (OnDrawCell event) and also adjust the row height as needed. Perhaps showing the full text in a popup hint would be easier to implement.


  7. 2 hours ago, m0njer0 said:

    I am using delphi rad studio 12. Does this version have a TextPrompt feature for the edit component?

    See the TextHint property of TEdit, that's probably what you are looking for. If not give us more detail.


  8. 16 hours ago, RTollison said:

    original delphi 5 new delphi 10.2

    word ole automation - original was word 2003 new is word 365

    i have been trying different things in the dll and found that 

    if I change all calls of

     

    FSession.Word.Selection.Paste()

     

    to 

     

    FSession.Word.Selection.PasteAndFormat(WdRecoveryType.wdFormatOriginalFormatting);

     

    it formats the same. but my page layout is off because original dot is 1 page and the newly created document is 2 pages.  the last part of the dot is a salutation type text but instead of bottom of the document it goes to the top of the next page. but overall the text/spacing "seems" to be the same. 

     

    The problem is likely the huge jump in the Word versions. Newer Word versions use a different document format and plainly refuse to edit documents in ancient formats like Word97, although you can still view them (my latest version installed is Word 2016, so still much older than Word365). You may have to rebuild your template dot with the new Word version to get it to work as you want.


  9. 21 hours ago, dormky said:

    I have a TDBRadioGroup with 2 options. Unfortunately, when pressing TAB to go from field to field, when it gets to the TDBRadioGroup you can't edit the values via keyboard. I tried space, enter and arrows, all with shift and ctrl.

    What's the deal here ? Is there no way to actually give the focus to this type of field and edit it via keyboard ?

     

    The TabOrder is correct and TabStop is True. Strangely enough, once you've clicked on an option it suddenly becomes available in the TAB navigation, and at the expected order. Not sure what's happening here, is it because there is no default value (none of the options are selected at first) ?

    A radio group, by its very nature, must have one of the options checked. If you need to indicate that none of your two options applies then that has to be added as a third option that is checked as default. What type of database field have you tied the group to?


  10. 17 hours ago, msd said:

    Alength := 2 shl errorLevel;

    This may not do what you expect it to do. ALength may be int64 but the compiler will calculate the right-hand side using a smaller integer type into which both the constant 2 and errorlevel fit and only extend the result to int64 before storing it into Alength. So the calculation may well overflow the range of the type used for the calculation, and since D12 has enabled overflow and range checks by default you get an exception. Change the code to

     

    Alength := int64(2) shl errorlevel;

    to force the use of int64 for the calculation.


  11. 3 hours ago, PiedSoftware said:

    I went to Component | Install Packages and unchecked "Embarcadero LiveBindings Components" and saved, but when I closed and reopened Delphi, it was back on again. D'oh! 

    I'm concerned the maybe a library is using it. How can I work that out? Should I remove it?

    The Install packages dialog affects the current project only if you have one open, and the IDE basic configuration if you have no project open. Changing the latter will not affect any projects you created before, though. To get rid of the package for good you have to edit the registry key HKEY_CURRENT_USER\SOFTWARE\Embarcadero\BDS\21.0\Known Packages (for D10) and rename the items for the dclbind*.bpl packages or move them top the "Disabled Packages" key.


  12. 5 hours ago, Ian Branch said:

    Hi Team,

    Books have been written about what I don't know about threading... 😉

    I have experimented with Anonympus threads.

    Is it possible to prevent the App doing anything except being moved, and parhas resized, while a thread is running?

    Regards & TIA,

    Ian

    Put all controls on the form on a client-aligned panel and then simply disable the panel while the background thread is active. Also use a handler for the OnCloseQuery event to prevent closing of the app while the thread is running. If you have a main menu bar tie all menu items to actions and disable the actionlist while the thread is running. Just don't forget to enable all the stuff again when the thread is done. :classic_cool:

    • Like 4

  13. Delphi forms tend to recreate their window handle at the drop of a hat. So move the DragAcceptFiles calls from the events to overridden CreateWnd and DestroyWnd methods, that makes sure the handle changes are properly handled.

    • Like 1

  14. 19 hours ago, Chris1701 said:

    I'll see what I can do but this is the only project that I've migrated to Delphi 12 that has this problem, none of my other projects have this issue and I'm not sure why.

    Check the project dpr file. Have you set Application.MainformOnTaskbar to false there? Does the form class override the CreateParams method or CreateWnd?


  15. It might be worth noting that XML documentation tags also work inside a normal Delphi comment (enclosed in braces {}) instead of these horrible triple slash comments copied from C# along with the XML tags themselves. Much easier to maintain in my opinion if a tag content spans several lines.


  16. 11 hours ago, Chris1701 said:

    I have hundreds of various projects that I've created over the years, I just went to make changes to one that I haven't worked on for a few months and last time I worked on it was with Delphi 11.3 and now I'm compiling and running it in Delphi 12 and it's an x64 Vcl application. The problem that I'm having it that when I hover the mouse over the taskbar icon it shows two program windows (see picture) and when I hover the mouse over the left appearing window it shows me the proper program form and the form title is the correct caption for the applications main form but if I hover the mouse over the right window the caption of that form appears to be the executable name rather than the caption and if you click on it all that pops up is the left appearing and correct program window / form. None of the other applications that I've converted to Delphi 12 seem to have this problem and just on the off chance that it was a problem with the project, I closed the project and deleted the project files and recreated the project and the new project seems to have the same problem.

     

    Just to be sure this is a Delphi 12 problem I opened the project in Delphi 11.3 and when I run it I don't have this problem with two application windows appearing on the taskbar.

     

    Has anyone ever seen this in any program on Delphi 12?

     

    The posted image is not large enough to make out any details unfortunately. Is this a MDI application by any chance? That is an area in the VCL where some major changes were made.


  17. 12 hours ago, Ian Branch said:

    Hi Team,

    Delphi 12.

    I am trying my hand at Semaphores.  Never touched them before this.

    ATT I have the following code:

    
      //
      // Create the named semaphore (if it doesn't already exist)
      GlobalSemaphore := TSemaphore.Create(nil, 1, 1, 'DBiAdminSemaphore');
      //
      try
        //
        if GlobalSemaphore.Acquire then
        begin

    I understand that if the Semaphore 'DBiAdminSemaphore' already exists, it won't be created again.

    If it already exists, I want to test for its existance, hence the thought of Acquire, but it seems Acquire doesn't return a Boolean.

    How do I test if the Semaphore already exists?

     

     

    You call GetLastError after the Create call. It will return ERROR_ALREADY_EXISTS if the named semaphore already exists. That also applies to other named synchronization objects, like mutexes. See the API function CreateSemaphoreW. TSemaphore inherits a property LastError from THandleObject, it may serve as well.

    • Like 1

  18. 22 hours ago, 2nd-Snoopy said:

    Hello, unfortunately I am not familiar with Delphi10.  I am using the Delphi 10.3.3 Community Edition. I have opened the project-file D103Install.groupproj and found the the two entries OverbyteIcsD103Run.bpl and OverbyteIcsD103Design.bpl. Both I can compile resp. build ('erzeugen'). But how can I install the Design.bpl? I have read on other place, that I have to do a 'right-Click' an the selectet Item and can there select 'Install'. But on my version of DelphiX there is no action with a right-Click. And after compile of the projectfile the exist not any file with suffix .dpl on my harddisk, which I can add manually (Install packages ...) ....   What can do, to to it right? What is wrong?

    If you're german you may want to post on the german DelphiPraxis site, link is at the top right of this page.

    Anyway: in the Tools -> Options dialog you can find the default folders the compiler will put package-related files in (*.bpl, *.dcp). But these can be overridden in the project options for each package project, so check there too. The project options should have "$(BDSCOMMONDIR)\BPL" as package output folder to use the IDE default.

    The run-time package has to be in a folder that is on the system PATH, since such packages are loaded by the OS following the same search logic used for DLLs (in fact packages are DLLs with some Delphi-specific extensions). The design-time package can be in a folder not on the PATH since the IDE loads design-time packages using the full path. The IDE installer adds the default folder for run-time packages to the PATH, but that may fail if your PATH is already very long, so better check it.

    As for installing: do you get no context menu if you right-click on the project name in the Project Manager view?

    image.thumb.png.3b4904096dc5c3c616f2a79b733b3488.png


  19. 5 hours ago, VicFan1 said:

    Somehow, I have set the font size for iSQL to something that looks like 150point size and I can figure out how to reset it back to something more reasonable.  I have tried holding down either shift, control or alternate and rotating the wheel on the mouse without success.  Anyone know how to reset the font size?

    iSQL is a console program. The system menu of the console should contain a menu item "Properties" (on my german Windows 10 it is called "Eigenschaften") and in the dialog that calls up you can set font size, color, name etc.


  20. On 1/10/2024 at 3:49 PM, dormky said:

    I've tried to install the https://github.com/CHERTS/newac component, but while it shows up in the Components list and the palette contains all the elements it should, dragging and dropping an element onto a form automatically adds the relevant units to the uses list... but Delphi can't resolve them.

     

    What could I have done wrong in the installation for this to happen ? I opened the .dpk file, right-clicked on the .bpl group and clicked Compile, then Install. Everything seemed to be fine until I actually tried it.

    I tried installing with both the NewAC file and the NewAC_Rio file (I'm on Delphi 10.3.2).

    Looks like the folder the created dcus are in is not on the IDE library path or the project's search path. Add that folder yourself.


  21. 15 hours ago, alogrep said:

    Hola Peter (not Paul!) Below😀.

    What happend:  there was a power failure. I exit the IDE (saving wip).  The PC was "shutting down" but the UPS ran out of battery before the shutting down terminated. Now the .pas file I am interested in is full of 

    '0' (checked with a binary file viewer. The history shws the file and the Buffer both empty.

    Withe the old system, the ~pas file that had been saved previusly, I would have lost the .pas and the wip,

    but I could have retrieved the .~pas. Here, I lost everything. 

    Which Delphi version are you using? If Delphi 10 or newer you should have _history and _recovery folders in the project's folder, look there. And for the future: make sure you have the autosave feature enabled in the IDE options dialog!

    image.thumb.png.38734ba983ade851e97750183bd1d16a.png


  22. On 1/8/2024 at 11:56 AM, alogrep said:

    Roger, sorry. I am talkng about this: since Delphi 5, everytime I saved a pas/dfm u nit, it would create a ~pas/~dfm AUTOMATICALlY.

    I did not have to go to _history (or _math), no, where the pas was, the ~pas was created.

    In the last couble of months this stopped happening. How Do I reestore taht useful feature?

     

    Newer Delphi versions do not create these files anymore since that did only allow one single backup version to be maintained. The _history folder allows multiple versions of the backup, which is much more useful in my opinion.

    • Like 2
×