VCL tips

Which Combo Box to use?
All combo boxes are a combination of a list box and an edit. But Delphi provides for three types of combo box styles:

  • Simple: an edit control is placed on top of a list box. Users can choose from the list or type text in the edit box. Use this style for short lists.
  • Drop-down: similar to the simple type, except that the list box isn't displayed until a drop-down button is clicked. To be used for long lists, or if there is not much room on the form.
  • Drop-down list: as with the drop-down style, the list isn't visible at first. Users can click the drop-down button and chose from the list, but they can't enter text in the edit portion. Use this type when you want users to select only from a fixed set of choices.

Transparent color of a glyph
When you place a glyph (bitmap-picture) on a button, the color of the pixel in the picture's lower-left corner will be used as the transparent color. All pixels of that color will be transparent. If you don't want any transparent parts on your button bitmap, make sure to use a color in the lower-left corner that is not used anywhere else in the bitmap.

Line number of the cursor in a TMemo
Use this Windows API function to determine which line the cursor is in:
LineNumber :=
SendMessage(Memo1.Handle,EM_LINEFROMCHAR,memo1.Selstart,0);

Making a group of components visible / invisible
If you want to make part of a form to be visible only from time to time, put these components on a separate Panel. Then, the Visible property of the panel to true or false.

More lines in a hint
If you want to display more than a one line in the hint of a control, for example of Button1, set it's property ShowHint to true. In the Object Inspector, don't put anything in Button1's hint property.
In the FormCreate event handler of the form that contains Button1, add this line:

Button1.Hint := 'First line' + chr(13) + 'Second line';

Click Here!

Webmasters: earn money with ValueClickWebmasters: earn money with ValueClickWebmasters: earn money with ValueClick
Webmasters: earn money! Become a ValueClick Host Site

⌐ Copyright 1999 
Studiebureau Festraets