summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-03-26 11:01:32 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-03-26 11:01:32 +0200
commit5c3868bf81c0957db82def8c6df5e7efedfeca76 (patch)
tree5fd8d4a7d48852dd6c532bcde88b6cb28b563b88 /src/gui
parenta853895e337175b010c1e1cc5fbc39ba81741e26 (diff)
downloadfpGUI-5c3868bf81c0957db82def8c6df5e7efedfeca76.tar.xz
TfpgEdit popup menu options enabled property not always set correctly.
When a Edit component is ReadOnly, not all the options was correctly disabled. Also, even though Delete (clear edit contents) was disabled, it still fired when enter key selected that option. Now all this is fixed.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/fpg_edit.pas12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gui/fpg_edit.pas b/src/gui/fpg_edit.pas
index 23d33d88..49e8d4a2 100644
--- a/src/gui/fpg_edit.pas
+++ b/src/gui/fpg_edit.pas
@@ -1159,6 +1159,8 @@ end;
procedure TfpgBaseEdit.DefaultPopupClearAll(Sender: TObject);
begin
+ if ReadOnly then
+ Exit; //==>
Clear;
end;
@@ -1174,13 +1176,13 @@ begin
itm := TfpgMenuItem(FDefaultPopupMenu.Components[i]);
// enabled/disable menu items
if itm.Name = ipmCut then
- itm.Enabled := FSelOffset <> 0
+ itm.Enabled := (not ReadOnly) and (FSelOffset <> 0)
else if itm.Name = ipmCopy then
itm.Enabled := FSelOffset <> 0
else if itm.Name = ipmPaste then
- itm.Enabled := fpgClipboard.Text <> ''
+ itm.Enabled := (not ReadOnly) and (fpgClipboard.Text <> '')
else if itm.Name = ipmClearAll then
- itm.Enabled := Text <> '';
+ itm.Enabled := (not ReadOnly) and (Text <> '');
end;
end;
end;
@@ -1212,16 +1214,12 @@ begin
FDefaultPopupMenu := TfpgPopupMenu.Create(nil);
itm := FDefaultPopupMenu.AddMenuItem(rsCut, '', @DefaultPopupCut);
itm.Name := ipmCut;
- itm.Enabled := not ReadOnly;
itm := FDefaultPopupMenu.AddMenuItem(rsCopy, '', @DefaultPopupCopy);
itm.Name := ipmCopy;
itm := FDefaultPopupMenu.AddMenuItem(rsPaste, '', @DefaultPopupPaste);
itm.Name := ipmPaste;
- itm.Enabled := not ReadOnly;
itm := FDefaultPopupMenu.AddMenuItem(rsDelete, '', @DefaultPopupClearAll);
itm.Name := ipmClearAll;
-
- itm.Enabled := not ReadOnly;
end;
SetDefaultPopupMenuItemsState;