Jump to content

PeterBelow

Members
  • Content Count

    18
  • Joined

  • Last visited

  • Days Won

    1

PeterBelow last won the day on January 27

PeterBelow had the most liked content!

Community Reputation

9 Neutral

1 Follower

Recent Profile Visitors

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

  1. PeterBelow

    Check for override

    A clear case of premature optimization, IMO 😉
  2. PeterBelow

    Check for override

    Well, you have been given some examples, but my question is: WHY do you want to know this? The whole point of polymorphism is that in the base class you do not need to know whether a descendant has overriden the method or not. In fact the base class does not even know whether there are descendents of it, and neither should it care. If you think you need to know whether a method has been overridden in descendents something is wrong with your class design, IMO.
  3. PeterBelow

    What is the compiler switch -VN used for?

    If you run the relevant external compiler from a command prompt without any parameters it should give you a list of the available switched and what they do.
  4. PeterBelow

    10.1 Berlin - no mouse hover inspect

    If you just opened the old project in 10.1 Berlin the project options will not be set correctly as far as debug information is concerned. In older versions the "debug information" setting in the compiler options was a simple boolean yes/no value. Later it morphed into a value with three possible values and the migration of the old project files does not take that into account. So check the compiler setting in the project options for the debug build.
  5. PeterBelow

    Dragging a control with $F012

    If you let the OS handle the drag your code is out of the picture until the drag ends, the OS uses an internal message loop to process mouse messages. The only way to hook into that would be a thread-specific message hook (see SetWindowsHookEx in the API docs). You may be better served to use the VCL drag support or handle the mouse yourself. Set the DoubleBuffered property of the paintbox to true, that should reduce the flicker.
  6. It's a VCL issue. I noted another yesterday: if you type text into a property (like caption) that is longer than what fits into the visible width of the OI column the text does not scroll while you type to keep the caret in view.
  7. PeterBelow

    HELP: Using C++ .dll in Delphi

    The docs you quoted state that the version is encoded in the *hexadecimal* value returned. You look at the decimal value. Decimal 11264 is hexadecimal 0x2c00 ($2C00 in Delphi notation). So the version is 2.12.0.0
  8. Perhaps these old routines can help you. They are Windows-only, though. {! <summary> Remove all key messages from the calling thread's message queue.</summary> } procedure EmptyKeyQueue; var Msg: TMsg; begin while PeekMessage(Msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE or PM_NOYIELD) do ; end; {! <summary> Remove all mouse messages from the calling thread's message queue.</summary> } procedure EmptyMouseQueue; var Msg: TMsg; begin while PeekMessage(Msg, 0, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE or PM_NOYIELD) do ; end; {! <summary> Remove all key and mouse messages from the calling thread's message queue.</summary> } procedure DiscardPendingInput; begin EmptyMouseQueue; EmptyKeyQueue; end;
  9. PeterBelow

    Splash screen doesn't show icon in taskbar

    What Delphi version are you using? In older versions the Application object was actually the one owning the taskbar button, all other forms used the (zero-size) window maintained by the Application object as API-level owner, and Window does not show taskbar buttons for owned windows.
  10. It makes automatic memory management via garbage collection easier to implement and more efficient as far as I know.
  11. PeterBelow

    How to create common CreateForm method?

    There is one loophole in your design: if a form is destroyed it will not automatically set the form variable the designer created for it to nil. I can only stress what has been posted in some of the other replies: do not use the form variables for forms that are not autocreated! Delete the variable declaration directly after the form unit has been created by the designer. Use local variables for modal forms (or a class method to create, use, and destroy them). For modeless forms you can always find existing instances by looking at the Screen.Forms array, or have the main form (which presumably creates such a form on an as needed basis) keep the reference in a private field. The automatic form variables encourage some bad programming practices (like accessing controls on another form directly) and become worse than useless if you have to have more than one instance of a given form class open at the same time.
  12. PeterBelow

    Quick and clean way to create auto-snapping forms

    What is build into the VCL is the drag and dock support also used by the RAD Studio IDE, the "snap to border" functionality is something different. If none of these two features match your need you have to build you own, which you seem to have done now. Do you know you can use inheritance with forms as well? Build a base form class with the functionality you need, add it to any new project you need this functionality in and then create new forms in the designer by using File -> New -> Others, and pick the base class from the "inheritable items" section. Just changing the ancestor class from TFrom to your base class in the editor does not work directly, since forms have associated DFM files. You would also need to edit the DFM file as text and change the first "object" to "inherited" for this to work.
  13. Via TStringHelper you have to first convert the string into an array of char, modify that, and then convert the array into a new string. var LChars: TArray<char>; LStr: string; begin LStr := StringOfChar('A', 20); LChars := LStr.ToCharArray; LChars[Low(LChars)+1] := LChars[Low(LChars)+1].ToLower; LStr := String.Create(LChars);
  14. PeterBelow

    Abnormal file size..

    The default for the linker options of a debug configuration is to include debug information into the produced EXE. That massively increases the size of the EXE, and, if you are using the IDE debugger (for a 32 bit project), is also completely useless, since the IDE debugger gets the debug info from the DCUs, not the EXE.
  15. PeterBelow

    Disable the Jedi property editors?

    You have to modify the design-time package that registers the property editor and rebuild it. Or just disable the package if you do not use any of the controls from it.
×