DelphiFeeds.com

  • Dashboard
  • Popular Stories
  • Trending Stories
  • Feeds
  • Login
Trending now

If you use an implementation of TNonRefCountInterfacedObject, then document in the descendants how lifetime management ...

High DPI Support, Improved TIFF and New Performance Demo in ImageEn Imaging Library v9.3.0

Easy-to-use Orbit Simulator Built In Delphi FireMonkey For Learning Gravitational Physics

Incredibly Powerful Enhanced Terminal And Network Toolkit For Windows Is Built In Delphi

Learn How To Use C++ Explicit Virtual Overrides In Windows Development

Learn Python With The 5 Best Python GUI Libraries Video

Trial – TMS VCL UI Pack

Brook Framework

Trial – TMS Scripter

Trial – TMS VCL Chart

Trial – TMS VCL Cloud Pack

Trial – TMS VCL WebGMaps

Get These Visually Stunning FireMonkey Styles Free To Enhance User Experience In Your Delphi Apps

VCL Styles: Master The Secrets Of Beautiful Modern Apps In Windows 10

grep for Delphi .dproj file containing copy commands for certain DLLs

Delphi Tip of the Day – OnShow SetFocus or Form1.ActiveControl

1
Michael Riley Michael Riley 10 months ago in Source Code, tip-of-the-day 0
I'm creating a simple database program to explore how SQLite works within Delphi. I want to be able to switch between three databases: Album, Test, and World. So I added a TComboBox and populated the Items property with three values; Album, Test, World. I also set TextHint := 'Choose Database...';

object ComboBox1: TComboBox
Left = 8
Top = 8
Width = 121
Height = 21
ParentShowHint = False
ShowHint = False
TabOrder = 0
TextHint = 'Choose database...'
Items.Strings = (
'Album'
'Test'
'World')

When I ran the program the TextHint for the ComboBox did not display:



That is not what I was expecting. The Combox was the active control which negates being able to see the TextHint "Choose database..."

So I added a little piece of code to the form's onShow event.

procedure TForm1.FormShow(Sender: TObject);
begin
StatusBar1.SetFocus;
end;

Now when I run the program right from the get-go the StatusBar componet has the focus and the ComboBox displays as intended.


Sometimes it's the small things that make all the difference!

An alternative  to using the OnShow event was suggested in the comments.

Form1.ActiveControl := StatusBar1


I love Delphi! 

Enjoy!
Semper Fi
Gunny Mike

Trending Stories

  • If you use an implementation of TNonRefCountInterfacedObject, then document in...

  • High DPI Support, Improved TIFF and New Performance Demo in...

  • Easy-to-use Orbit Simulator Built In Delphi FireMonkey For Learning Gravitational...

  • Incredibly Powerful Enhanced Terminal And Network Toolkit For Windows Is...

  • Learn How To Use C++ Explicit Virtual Overrides In Windows...

Embarcadero GetIt

  • Brook Framework

    Microframework which helps to develop web Pascal applications.

  • Trial - TMS Scripter

    Add the ultimate flexibility and power into your apps with native Pascal or Basic scripting and […]

  • Trial - TMS VCL Chart

    DB-aware and non DB-aware feature-rich charting components for business, statistical, financial […]

  • Trial - TMS VCL Cloud Pack

    TMS VCL Cloud Pack is a Delphi and C++Builder component library to seamlessly use all major cloud […]

  • Trial - TMS VCL UI Pack

    Create modern-looking & feature-rich Windows applications faster with well over 600 components […]

  • Learn Delphi Programming
  • Learn C++
  • Embarcadero Blogs
  • BeginEnd.net
  • Python GUI
  • Firebird News
  • Torry’s Delphi Pages
Copyright DelphiFeeds.com 2021. All Rights Reserved
Embarcadero
Login Register

Login

Lost Password

Register

Lost Password