One would wonder how though 'better' code would be
Tmainform.AddtoFavourites1Click(Sender: TObject); var TempStr: string;
begin //Test for valid edit mode, if not, close PopUp
if not (ActiveControl is TCustomEdit) then
begin
PostMessage(Handle, WM_LBUTTONDOWN, MK_LBUTTON, 0);
PostMessage(Handle, WM_LBUTTONUP, MK_LBUTTON, 0);
// exit;
end else
with Activecontrol as TCustomEdit do
begin
if Length(SelText) > 0 then
begin
TempStr := ParseMailAdds(SelText);Also I'm v wary of great blocks of code under a 'Activecontrol as TCustomEdit'
typecast I think you are better to
Tmainform.AddtoFavourites1Click(Sender: TObject); var TempStr: string; begin //Test for valid edit mode, if not, close PopUp var CustomEdit: TCustomEdit;
if not (ActiveControl is TCustomEdit) then
begin
PostMessage(Handle, WM_LBUTTONDOWN, MK_LBUTTON, 0);
PostMessage(Handle, WM_LBUTTONUP, MK_LBUTTON, 0);
// exit;
end else
begin
CustomEdit := TCustomEdit(ActiveControl);
if Length(CustomEdit .SelText) > 0 then
begin
TempStr := ParseMailAdds(CustomEdit.SelText);HTH
Neven MacEwan (B.E. E&E)
Ph. 09 621 0001 Mob. 0274 749062
Leo wrote:
Tmainform.AddtoFavourites1Click(Sender: TObject); var TempStr: string; begin //Test for valid edit mode, if not, close PopUp if not (ActiveControl is TCustomEdit) then begin PostMessage(Handle, WM_LBUTTONDOWN, MK_LBUTTON, 0); PostMessage(Handle, WM_LBUTTONUP, MK_LBUTTON, 0); exit; end;
Activecontrol is not TCustomEdit here
with Activecontrol as TCustomEdit do begin if Length(SelText) > 0 then begin TempStr := ParseMailAdds(SelText);
Leo
Software Developer CFL [EMAIL PROTECTED] http://www.cfl.co.nz
_______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
_______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
