Putting Hints in Status Bar

Putting Hints in Status Bar

Question:
I am using the application.onhint example from the Delphi help files to put all hints in my status bar. It works on all but one form. I’m using the Client Server version of Delphi 3.

Thanks in advance.

Neil Griffiths
Junior Developer, Information Solution LTD
Ireland

Answer:
I’ll answer the question so long as you send me a couple of pints of Harp’s. Never mind…

This solution could be as simple as making sure that your status bar’s (if you’re using TStatusBar) SimpleText property is set to true. Check this first. Then check to see if you’re doing the text assignment properly. In any case, let’s take a look at some theory, shall we?

You have to remember that methods can be reassigned as long as the “replacement” procedures have the _exact_ same declaration structure as the method. The reason this works is because events are simply method pointer variables that don’t represent anything but a pointer to a type of procedure. For instance, OnHint will be defined as:

property OnHint : TNotifyEvent;

where TNotifyEvent = procedure(Sender : TObject) of object;What this boils down to is that as long as a procedure fits the required declaration structure of a method, you can reassign the method. But as I said above, it has to be exact.

Let’s look at some code that I use for my applications:

procedure TForm1.Create(Sender : TObject);begin  Application.OnHint := ShowHint; //re-assignend;procedure TForm1.ShowHint(Sender : TObject);begin  StatusBar1.SimpleText := Application.Hint;end;

This is pretty straight-forward stuff. So as long as you follow the example above, you shouldn’t have any problems.

Share the Post:
XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing

data dictionary

Tools You Need to Make a Data Dictionary

Data dictionaries are crucial for organizations of all sizes that deal with large amounts of data. they are centralized repositories of all the data in organizations, including metadata such as