Jump to content

PeterBelow

Members
  • Content Count

    508
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by PeterBelow

  1. PeterBelow

    Wrap texts in DBGrid

    TDBGrid does not support that. If you have fields with long text a grid is not the best way to show it, better use a TDBMemo in addition to the grid and tie it to the field in question. It will them show the field content of the record active in the grid as the user scrolls through the records.
  2. Look at the System.Hash unit, this kind of problem is usually the domain of hashing.
  3. PeterBelow

    Delphi 12CE and SQLite

    Yes, apart from the licence restriction re yearly revenue.
  4. PeterBelow

    Can I make the form larger in the IDE?

    Take a look at TVirtualImagelist and TVirtualimageCollection, these allow you to supply different versions (sizes) of bitmaps optimized for the DPI settings your app may encounter in the wild. This tends to look better than getting the images scaled at runtime from a single sized version.
  5. PeterBelow

    Delphi 12CE and SQLite

    You do not have the source (pas) for the unit and you should never set up a project to have the source files for Delphi RTL etc. units on its search path. You should have the precompiled FireDAC.Phys.SQLiteWrapper.dcu, though, and the path to its folder should be on the IDE library path for the target platform in question.
  6. PeterBelow

    eztwain.obj для 64 bit

    You need a 64-bit obj file for that. Is this for a C++-Builder or a Delphi project?
  7. PeterBelow

    Can I make the form larger in the IDE?

    I you are running the IDE on a monitor with scaling set to anything other than 100% it matters if you have enabled high DPI support for the form designer or not (the latter is equivalent to launching the IDE via the Delphi (DPI unware) shortcut the installer provides in the start menu group. You can find the relevant setting in the Tools -> Options dialog:
  8. PeterBelow

    Problem with EmbeddedWB in Delphi 12

    Can you not just ditch it and use TEdgeBrowser supplied with Delphi instead?
  9. PeterBelow

    C variable from delphi

    The Delphi program folder contains a console program named tdump.exe (and tdump64.exe for 64 bit executables) that you can use to examine the segments of the C DLL. Look for the exports table and check whether there is an entry for this params variable. If there is you can load the DLL from Delphi (LoadLibrary) and retrieve the address of this export via GetProcAddress, like for an exported function. Store the returned address into a variable of a suitably defined pointer type and you can access the value of the variable.
  10. PeterBelow

    Get notified when a form is created/shown?

    Perhaps you can use the Screen.OnActiveFormChange event for this. But keep in mind that it is not only called when a new form is shown but also when focus changes between forms. It may also happen too late for your purpose.
  11. PeterBelow

    tag as String

    Good to know one can learn something new even at my age :)...
  12. PeterBelow

    tag as String

    If you want to be able to edit this new property in the IDE Object Inspector I don't see a way to do this since it would require not only a change of the source code of the TComponent class but also a rebuild of all design and run-time packages that use TComponent, and you do not have the source code for all of them, as far as I know. If using this property in code would be enough there may be a way to fake it using a class helper for TComponent that uses the existing Tag property to store an index of the actual string held in some global container, like a TStringlist.
  13. PeterBelow

    String memory usage

    Depends on how you store the loaded names. If these are records from a database, for instance, and you access them via a query or table component each result row will have its own memory, regardless of what it contains. With a query you have the option of removing duplicates in the SQL statement used, but only if the row does not have any other columns with non-duplicate content. If you load the names into a TStringlist you can set the list's Duplicates property to dupIgnore, it will then discard values already in the list when you try to add them.
  14. PeterBelow

    Strange effect in TRichEdit: CTRL+I outputs TAB

    You have to use OnKeyPress and check for Ctrl down there. The behaviour you see is perfectly OK, by the way. Ctrl-<letter> combos have created control characters since the ancient days of DOS, and ^I (#9) is the TAB character...
  15. PeterBelow

    ​LOST DEBUGGER ON EDIT ERROR timeout trigger.

    The debugger will show exceptions before they are trapped in try except blocks in the code. The dialog you got allows you to tell it to not show this particular exception type in the future. To re-enable it you have to go into the IDE options dialog (Tools -> Options). Under the "Debugger" node you find (under "Embarcadero Debuggers") two lists with the exception classes to ignore. Just uncheck the one you blocked. Note that the dialog may look a little different if you use a Delphi version older than 12.
  16. PeterBelow

    problem with ComboBox

    No, since it is not a user-triggered change from the combobox's view.
  17. You would have to draw cell content yourself (OnDrawCell event) to achieve that, but in my opinion such behaviour is a horrible idea in the first place. It would give a very uneven grid appearance and you will also have the problem that larger font sizes than the grid default will also require a bigger row hight to avoid text cut off at the bottom. Either adjust the column width or (more difficult) implement word wrap for cells with longer text. That also requires drawing the cell yourself and adjusting the row hight, which is tricky since it will trigger a redraw of the row and thus fire OnDrawCell again. An alternative is to use the grid with reasonable default font size and column autofit and place a panel or frame with individual edit and memo fields below it. Clicking on a grid row shows the content of the row in the individual controls of the panel, the content of which the user can scroll if required.
  18. PeterBelow

    Caption alignment in a TButtonGroup??

    The "buttons" in such a group are of class TGrpButtonItem and that class does not seem to offer a way to adjust the alignment. But the TButtonGroup itself has a number of events you can handle to draw the buttons yourself, like OnDrawButton. Better study the source to see how the buttons are drawn by default to see how you can modify that.
  19. PeterBelow

    When will we have a 64-bit IDE version ?

    The IDE is 32 bits. The 64 bit compiler is a separate executable, which is why it can only be used if you compile via MSBuild. It is intended for use on build servers as I understand it, not while you're working in the IDE.
  20. PeterBelow

    how to correct this Code

    Well, what do you want to achieve here? Look at the source code for TControl, from which TPanel inherits the Caption property and its SetText and GetText accessor methods. procedure TControl.SetTextBuf(Buffer: PChar); begin Perform(WM_SETTEXT, 0, Buffer); Perform(CM_TEXTCHANGED, 0, 0); end; Setting a control's Caption or Text properties ends up sending messages to the control. WM_SETTEXT stores the passed string and CM_TEXTCHANGED is a notification for the control that the caption or content has changed, which typically makes the control redraw itself. TCustomPanel, the immediate ancestor of TPanel, has a private message handler procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED; that just calls Invalidate to redraw the panel. If you want to react to a change of the panel Caption you have to add a handler for this message to your modified TPanel class. You cannot override the parent method since it is not virtual or dynamic and also private. But you can call the inherited message handler inside your handler using the inherited keyword. If you just want a panel that does not show the Caption: it has a ShowCaption property that you can set to false to achieve that. You could set that in an overridden Loaded method.
  21. Interbase is a SQL database. The book you are using seems to be very old, probably written for an ancient Delphi version like Delphi 7, which used the Borland Database Engine (BDE) for database access and the Database Desktop app for managing the database. This is about 20 years out of date; the BDE has not been offficially supported for more than a decade and it and its tools are difficult to install and get to work on Windows 10 or 11. If you want to learn to program in Delphi get the free Delphi Community edition. It comes with a modern version of Interbase and allows you to build application using a local database. The IDE has an integrated database view that can be used for simple database management, but the Interbase installation has its own toolset, like ISQL, which you can use to execute DDL (Database Definition Language) scripts to manage the database.
  22. PeterBelow

    Simulate Multiple Inheritance

    Interfaces can only have methods, not fields. Your Thing property needs a GetThing method as read accessor and the implemention can then refer to the FThing field of the class implementing the interface. Interfaces also imply lifetime management by reference counting (that comes from their original purpose in Delphi to work with COM). All classes derived from TInterfacedObject have the necessary infrastructure build in, but beware: classes derived from TComponent inherit an implementation of the relevant methods (_AddRef and _Release) that is not reference-counted, since the lifetime of components is controlled by their Owner. So do never store an interface reference obtained from a component in a field/variable that may outlive the component itself, that is a sure way to produce access violations when the compiler-generated code tries to finalize said reference when the field/variable goes out of scope!
  23. PeterBelow

    On Posterror real error ;

    In the OnPostError handler you have to store the error code (E.Errorcode) or the class of the exception passed to the handler (E.Classtype) into a field of the datamodule. Since you told the handler to abort the operation the exception you trap in the try except block will always reflect that, but you can examine the value stored by the handler to figure out what went wrong. But be careful, it is not a good idea to execute code from an except block that may trigger another exception. Just set a flag, that indicates the action to take and act on that after the try except block. Oh, by the way, do not store the E parameter's reference in the handler, that may become invalid after the handler returns since it probably destroys the exception object...
  24. That is not relevant for Unicode UTF-16, which is what the String type uses in all Delphi releases since more than a decade. Who relies an ANSI/MBCS strings these days anymore? Windows has used Unicode internally for ages...
  25. PeterBelow

    Can Control Elements have "EventHandlers"?

    If you look at the VCL source (if you have it) in the design the VCL follows each component having an event also has a virtual or dynamic method, usually protected, that fires the event. This method can be overridden in descendants to change the way the component handles the event. So, in your case, you would implement such a method to provide the default processing and optionally to also fire an associated event, if a handler has been assigned to it.
×