Archive for January 2007

Show hint on disabled control

January 29, 2007

If a control is disabled (Enable = False) then the mouseover hint is not shown. If You need to show the hint then put the control on a TPanel and set TPanel’s Hint property. Or just put a TPanel behind the control (send to back) – this works also.

Showing hint on disabled control

Popup menu with MDI

January 11, 2007

Situation: we have a MDI application whose main form (FormStyle = fsMDIForm) has a TPopupMenu (MainForm.PopupMenu = PopupMenu1) for some shortcut functions when user clicks mouse on the main form.

Problem: this PopupMenu1 is popping up everywhere in all the MDI children windows, but we want to use for example the Windows default popup menu in edit boxes:


Solution: Remove the PopupMenu1 from main form’s properties and create an OnContextPopup event handler:

procedure TMainForm.FormContextPopup(Sender: TObject;
  MousePos: TPoint; var Handled: Boolean);
  ScreenPoint: TPoint;
  // convert client area coordinates
  // to global screen coordinates
  ScreenPoint := ClientToScreen(MousePos);
  // see if the control under cursor in our main form
  if (FindDragTarget(ScreenPoint, True) is TMainForm)
  then begin
    // show our shortcut menu
    PopupMenu1.Popup(ScreenPoint.X, ScreenPoint.Y);
    // we handled the request for context menu
    Handled := True;

Testing Estonian National identification number (isikukood)

January 7, 2007

As a followup to the SOTU checking function, here’s a function that checks the validity of Estonian National identification number.


Testing Finnish National identification number (SOTU)

January 5, 2007

Here’s a sample function to test the validity of Finnish National identification number (henkil√∂tunnus (HETU)), formerly known as sosiaaliturvatunnus (SOTU)).