formplacementsaver OnRegKeyNotFound event
Return to Introduction  Previous page  Next page
Applies to
acFormPlacementSaver component.  

Declaration
property OnRegKeyNotFound: TNotifyEvent;  

Description
The OnRegKeyNotFound event occurs if the form placement information was not found in the registry and the component is unable to restore previous form's placement.  
 
Use this event to specify default values for some settings of your application, if it unable to restore them from registry.  

Example
// This example taken from one of ours end-user application. It specifies default values for some settings,  
// makes program executable on Windows startup and puts the form to right-bottom corner of desktop  
uses acUtils; // this is to use GetWorkArea routine  
 
procedure TMainForm.SaverRegKeyNotFound(Sender: TObject);  
var  
  WorkArea: TRect;  
begin  
  // set default options  
  PlaySound := True;  
  PopupWindow := True;  
  FlashIcon := True;  
  DontResolveHostnames := False;  
  LoadActive := True;  
  acAppAutoRun1.AutoRun := True;  
 
  // move form to right-bottom corner of desktop  
  WorkArea := GetWorkArea;    
  SetBounds(WorkArea.Left + WorkArea.Right - Width,  
            WorkArea.Top + WorkArea.Bottom - Height,  
            Width, Height);  
end;  

See also
OnLoadSettings and OnSaveSettings events.