Jump to content

PeterBelow

Members
  • Content Count

    501
  • Joined

  • Last visited

  • Days Won

    13

PeterBelow last won the day on April 30

PeterBelow had the most liked content!

Community Reputation

238 Excellent

1 Follower

Technical Information

  • Delphi-Version
    Delphi 11 Alexandria

Recent Profile Visitors

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

  1. PeterBelow

    Problem with EmbeddedWB in Delphi 12

    Can you not just ditch it and use TEdgeBrowser supplied with Delphi instead?
  2. 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.
  3. 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.
  4. PeterBelow

    tag as String

    Good to know one can learn something new even at my age :)...
  5. 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.
  6. 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.
  7. 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...
  8. 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.
  9. PeterBelow

    problem with ComboBox

    No, since it is not a user-triggered change from the combobox's view.
  10. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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!
×