fixes some bugs in the OnClose event handler from A.J.

git-svn-id: trunk@9430 -
This commit is contained in:
mattias 2006-06-13 19:36:52 +00:00
parent b9f853b989
commit f2a240041b
4 changed files with 38 additions and 15 deletions

View File

@ -12,7 +12,7 @@ object Form1: TForm1
Width = 214
object Button1: TButton
BorderSpacing.InnerBorder = 4
Caption = 'Show/Hide Popup'
Caption = 'Show Popup'
OnClick = Button1Click
TabOrder = 0
Left = 24
@ -1005,6 +1005,7 @@ object Form1: TForm1
}
Text = 'This is a test Message'
Title = 'TestPopup'
OnClose = PopupNotifier1Close
top = 187
end
end

View File

@ -1,17 +1,19 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'
+#12'ClientHeight'#3#214#0#11'ClientWidth'#3#214#0#13'PixelsPerInch'#2'V'#18
+'HorzScrollBar.Page'#3#213#0#18'VertScrollBar.Page'#3#213#0#4'Left'#3#251#1#6
+'Height'#3#214#0#3'Top'#3#156#0#5'Width'#3#214#0#0#7'TButton'#7'Button1'#25
+'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#15'Show/Hide Popup'#7'OnClick'#7
+#12'Button1Click'#8'TabOrder'#2#0#4'Left'#2#24#6'Height'#2#25#3'Top'#2#8#5'W'
+'idth'#3#160#0#0#0#5'TMemo'#5'Memo1'#13'Lines.Strings'#1#6#22'This is a test'
+' message'#0#8'TabOrder'#2#1#4'Left'#2#24#6'Height'#2'Z'#3'Top'#2'P'#5'Width'
+#3#158#0#0#0#5'TEdit'#5'Edit1'#8'TabOrder'#2#2#4'Text'#6#10'Test Popup'#4'Le'
+'ft'#2#24#6'Height'#2#23#3'Top'#2'0'#5'Width'#3#155#0#0#0#7'TButton'#7'Butto'
+'n2'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#10'Edit Popup'#7'OnClick'
+#7#12'Button2Click'#8'TabOrder'#2#3#4'Left'#2#24#6'Height'#2#25#3'Top'#3#176
+#0#5'Width'#3#158#0#0#0#14'TPopupNotifier'#14'PopupNotifier1'#5'Color'#4#255
+'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#10'Show Popup'#7'OnClick'#7#12
+'Button1Click'#8'TabOrder'#2#0#4'Left'#2#24#6'Height'#2#25#3'Top'#2#8#5'Widt'
+'h'#3#160#0#0#0#5'TMemo'#5'Memo1'#13'Lines.Strings'#1#6#22'This is a test me'
+'ssage'#0#8'TabOrder'#2#1#4'Left'#2#24#6'Height'#2'Z'#3'Top'#2'P'#5'Width'#3
+#158#0#0#0#5'TEdit'#5'Edit1'#8'TabOrder'#2#2#4'Text'#6#10'Test Popup'#4'Left'
+#2#24#6'Height'#2#23#3'Top'#2'0'#5'Width'#3#155#0#0#0#7'TButton'#7'Button2'
+#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#10'Edit Popup'#7'OnClick'#7
+#12'Button2Click'#8'TabOrder'#2#3#4'Left'#2#24#6'Height'#2#25#3'Top'#3#176#0
+#5'Width'#3#158#0#0#0#14'TPopupNotifier'#14'PopupNotifier1'#5'Color'#4#255
+#255#220#0#9'Icon.Data'#10#213'v'#0#0#7'TPixmap'#201'v'#0#0'/* XPM */'#10'st'
+'atic char * mainicon_xpm[] = {'#10'"48 48 1597 2",'#10'" '#9'c None",'#10
+'". '#9'c #7E7B50",'#10'"+ '#9'c #636546",'#10'"@ '#9'c #323F32",'#10'"# '#9
@ -569,6 +571,6 @@ LazarusResources.Add('TForm1','FORMDATA',[
+' ",'#10'"B!C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X'
+'!Y!Z!`! ~.~+~@~#~$~ ",'#10'"%~&~*~=~-~;~>~,~'
+'g J>''~)~!~~~{~d.]~^~/~(~U!_~:~<~[~}~|~1~2~3~4~ '
+' "};'#10#4'Text'#6#22'This is a test Message'#5'Title'#6#9'TestPopup'#3
+'top'#3#187#0#0#0#0
+' "};'#10#4'Text'#6#22'This is a test Message'#5'Title'#6#9'TestPopup'#7
+'OnClose'#7#19'PopupNotifier1Close'#3'top'#3#187#0#0#0#0
]);

View File

@ -20,6 +20,8 @@ type
PopupNotifier1: TPopupNotifier;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure PopupNotifier1Close(Sender: TObject; var CloseAction: TCloseAction
);
private
{ private declarations }
public
@ -38,9 +40,11 @@ begin
If PopupNotifier1.Visible then
Begin
PopupNotifier1.Hide;
Button1.Caption := 'Show Popup';
end else
begin
PopupNotifier1.ShowAtPos(100,100);
Button1.Caption := 'Hide Popup';
end;
end;
@ -57,6 +61,12 @@ begin
end;
end;
procedure TForm1.PopupNotifier1Close(Sender: TObject;
var CloseAction: TCloseAction);
begin
Button1.Caption := 'Show Popup';
end;

View File

@ -75,6 +75,7 @@ type
function GetVisible: Boolean;
procedure SetVisible(const Value: Boolean);
procedure SetOnClose(const Value: TCloseEvent);
function GetOnClose:TCloseEvent;
public
vNotifierForm: TNotifierForm;
constructor Create(AOwner: TComponent); override;
@ -88,7 +89,7 @@ type
property Text: string read GetText write SetText;
property Title: string read GetTitle write SetTitle;
property Visible: Boolean read GetVisible write SetVisible;
property OnClose: TCloseEvent write SetOnClose;
property OnClose: TCloseEvent read GetOnClose write SetOnClose;
end;
const
@ -229,12 +230,12 @@ end;
* Releases associated resources of the notifier form
*******************************************************************}
destructor TNotifierForm.Destroy;
begin
ImgIcon.Free;
lblTitle.Free;
lblText.Free;
BtnX.Free;
inherited Destroy;
end;
@ -244,7 +245,10 @@ end;
* Utilized for events that hide the form, such as clicking on it
*******************************************************************}
procedure TNotifierForm.HideForm(Sender: TObject);
Var NoValue :TCloseAction;
begin
if Assigned(OnClose) then
OnClose(Self,NoValue);
Hide;
end;
@ -322,9 +326,15 @@ end;
procedure TPopupNotifier.SetOnClose(const Value: TCloseEvent);
begin
vNotifierForm.OnClose := Value;
VNotifierForm.Onclose := Value;
end;
function TPopupNotifier.GetOnClose:TCloseEvent;
begin
Result := VNotifierForm.Onclose;
end;
function TPopupNotifier.GetVisible: Boolean;
begin
Result := vNotifierForm.Visible;