summaryrefslogtreecommitdiff
path: root/examples/gui/hintwindow
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-08-31 17:24:54 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-08-31 17:24:54 +0000
commit1405e1ecfd53e424c3e96edccdf2e5b0b707257b (patch)
treee2acb5e89e78a1f229f35d74966577ba0fcb7887 /examples/gui/hintwindow
parent052d28c91a70678b264fb7772096da6fb6803dc3 (diff)
downloadfpGUI-1405e1ecfd53e424c3e96edccdf2e5b0b707257b.tar.xz
* Renamed the hint window to TfpgHintWindow
* Moved F_Hint variable to fpgApplication.HintWindow property. TfpgApplication now manages the life of HintWindow. * Moved DisplayHint (now called ActivateHint) and HideHint into TfpgApplication. * Introduced a new TfpgApplication.HintPause property that will managed the default delay before a help hint is displayed. Default is 1.5 seconds. * gui_edit unit has been updated to handle the new changes. * hintwindow example project has been updated to handle the new changes. * TfpgHintWindow class now manages the Shadow Window (lifetime, size and position). * The Hint Shadow class is now moved to the Implementation section so it's not accessible to the world, but only via the standard Hint Window class. * Introduced a HintWindowClass which is a global variable. It defaults to TfpgHintWindow, but allows the user to change it so a custom hint window can be used instead. * TfpgLabel.Text is now of type TfpgString
Diffstat (limited to 'examples/gui/hintwindow')
-rw-r--r--examples/gui/hintwindow/edittest.lpr75
1 files changed, 51 insertions, 24 deletions
diff --git a/examples/gui/hintwindow/edittest.lpr b/examples/gui/hintwindow/edittest.lpr
index 33682a65..b0309792 100644
--- a/examples/gui/hintwindow/edittest.lpr
+++ b/examples/gui/hintwindow/edittest.lpr
@@ -15,6 +15,7 @@ type
TMainForm = class(TfpgForm)
private
+ function GetHintWnd: TfpgHintWindow;
procedure btnQuitClicked(Sender: TObject);
procedure rbClicked(Sender: TObject);
procedure lbChange(Sender: TObject);
@@ -106,6 +107,11 @@ type
{@VFD_NEWFORM_IMPL}
+function TMainForm.GetHintWnd: TfpgHintWindow;
+begin
+ Result := TfpgHintWindow(fpgApplication.HintWindow);
+end;
+
procedure TMainForm.btnQuitClicked(Sender: TObject);
begin
Close;
@@ -222,133 +228,133 @@ end;
procedure TMainForm.rb_border_1Change(Sender: TObject);
begin
if rb_border_1.Checked then
- F_Hint.Border := 1;
+ GetHintWnd.Border := 1;
end;
procedure TMainForm.rb_border_2Change(Sender: TObject);
begin
if rb_border_2.Checked then
- F_Hint.Border := 2;
+ GetHintWnd.Border := 2;
end;
procedure TMainForm.rb_border_3Change(Sender: TObject);
begin
if rb_border_3.Checked then
- F_Hint.Border := 3;
+ GetHintWnd.Border := 3;
end;
procedure TMainForm.rb_border_5Change(Sender: TObject);
begin
if rb_border_5.Checked then
- F_Hint.Border := 5;
+ GetHintWnd.Border := 5;
end;
procedure TMainForm.rb_margin_1Change(Sender: TObject);
begin
if rb_margin_1.Checked then
- F_Hint.Margin := 1;
+ GetHintWnd.Margin := 1;
end;
procedure TMainForm.rb_margin_2Change(Sender: TObject);
begin
if rb_margin_2.Checked then
- F_Hint.Margin := 2;
+ GetHintWnd.Margin := 2;
end;
procedure TMainForm.rb_margin_3Change(Sender: TObject);
begin
if rb_margin_3.Checked then
- F_Hint.Margin := 3;
+ GetHintWnd.Margin := 3;
end;
procedure TMainForm.rb_margin_5Change(Sender: TObject);
begin
if rb_margin_5.Checked then
- F_Hint.Margin := 5;
+ GetHintWnd.Margin := 5;
end;
procedure TMainForm.rb_time_1Change(Sender: TObject);
begin
if rb_time_1.Checked then
- F_Hint.Time := 1000;
+ GetHintWnd.Time := 1000;
end;
procedure TMainForm.rb_time_2Change(Sender: TObject);
begin
if rb_time_2.Checked then
- F_Hint.Time := 2000;
+ GetHintWnd.Time := 2000;
end;
procedure TMainForm.rb_time_3Change(Sender: TObject);
begin
if rb_time_3.Checked then
- F_Hint.Time := 3000;
+ GetHintWnd.Time := 3000;
end;
procedure TMainForm.rb_time_5Change(Sender: TObject);
begin
if rb_time_5.Checked then
- F_Hint.Time := 5000;
+ GetHintWnd.Time := 5000;
end;
procedure TMainForm.rb_color_blackChange(Sender: TObject);
begin
if rb_color_black.Checked then
- F_Hint.LTextColor := clBlack;
+ GetHintWnd.LTextColor := clBlack;
end;
procedure TMainForm.rb_color_redChange(Sender: TObject);
begin
if rb_color_red.Checked then
- F_Hint.LTextColor := clRed;
+ GetHintWnd.LTextColor := clRed;
end;
procedure TMainForm.rb_color_greenChange(Sender: TObject);
begin
if rb_color_green.Checked then
- F_Hint.LTextColor := clGreen;
+ GetHintWnd.LTextColor := clGreen;
end;
procedure TMainForm.rb_color_blueChange(Sender: TObject);
begin
if rb_color_blue.Checked then
- F_Hint.LTextColor := clBlue;
+ GetHintWnd.LTextColor := clBlue;
end;
procedure TMainForm.rb_bgcolor_yellowChange(Sender: TObject);
begin
if rb_bgcolor_yellow.Checked then
- F_Hint.LBackgroundColor := TfpgColor($ffffbf); //clYellow;
+ GetHintWnd.LBackgroundColor := TfpgColor($ffffbf); //clYellow;
end;
procedure TMainForm.rb_bgcolor_whiteChange(Sender: TObject);
begin
if rb_bgcolor_white.Checked then
- F_Hint.LBackgroundColor := clWhite;
+ GetHintWnd.LBackgroundColor := clWhite;
end;
procedure TMainForm.rb_bgcolor_greenChange(Sender: TObject);
begin
if rb_bgcolor_green.Checked then
- F_Hint.LBackgroundColor := clPaleGreen;
+ GetHintWnd.LBackgroundColor := clPaleGreen;
end;
procedure TMainForm.rb_bgcolor_blueChange(Sender: TObject);
begin
if rb_bgcolor_blue.Checked then
- F_Hint.LBackgroundColor := clLightBlue;
+ GetHintWnd.LBackgroundColor := clLightBlue;
end;
procedure TMainForm.rb_shadowcolor_grayChange(Sender: TObject);
begin
if rb_shadowcolor_gray.Checked then
- F_Hint.ShadowColor := clGray;
+ GetHintWnd.ShadowColor := clGray;
end;
procedure TMainForm.rb_shadowcolor_blackChange(Sender: TObject);
begin
if rb_shadowcolor_black.Checked then
- F_Hint.ShadowColor := clBlack;
+ GetHintWnd.ShadowColor := clBlack;
end;
procedure TMainForm.AfterCreate;
@@ -692,8 +698,6 @@ begin
chbShowHint := CreateCheckBox(Self,200,500,'Show hint');
chbShowhint.OnChange:= @chbShowHintChange;
- F_Hint := TF_Hint.Create(nil);
- F_Hint.Visible := False;
{@VFD_BODY_END: MainForm}
@@ -703,10 +707,32 @@ begin
rbComma.Checked := True;
end;
+
+type
+ { A very simple custom hint window. }
+ TMyHintWindow = class(TfpgHintWindow)
+ public
+ constructor Create(AOwner: TComponent); override;
+ end;
+
+{ TMyHintWindow }
+
+constructor TMyHintWindow.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ MinWidth := 400;
+ MinHeight := 200;
+end;
+
+
procedure MainProc;
var
frm: TMainForm;
begin
+ // To apply custom hint window, uncomment the two lines below
+// fpgApplication;
+// HintWindowClass := TMyHintWindow;
+
fpgApplication.Initialize;
frm := TMainForm.Create(nil);
try
@@ -717,6 +743,7 @@ begin
end;
end;
+
begin
MainProc;
end.