trichview.support
Re: Deleting an item as Whole |
Author |
Message |
Anderson Wilson |
Posted: 06/16/2005 21:43:35 Hi, I'm still looking for an "easy way" to let the user delete a textitem as whole, just by pressing DEL, when the item has rvprModifyProtect in its protection options. In the meantime I came up with a temporary solution, where the work of selecting the whole item is done when the user doubleclicks on the Text item that has the rvprModifyProtect set. Then the user just need to hit DEL. The following procedure is working fine and took me a while to make it work inside tables, maybe it can help others with similar situation. procedure TfrmTemplate.RichViewEdit1RVDblClick(Sender: TCustomRichView; ClickedWord: String; Style: Integer); var i: integer; rve: TCustomRichViewEdit; begin rve := TRichViewEdit(Sender); if (Style >= 0) and (rvprModifyProtect in rve.Style.TextStyles.Items[Style].Protection) then begin if (rve.InplaceEditor<>nil) and (rve.InplaceEditor is TCustomRichViewEdit) then rve := TCustomRichViewEdit(rve.InplaceEditor); i := rve.CurItemNo; rve.SetSelectionBounds(i, 1, i, length(rve.GetItemText(i))+1); rve.Invalidate; end; end; Best regards Anderson Anderson Wilson wrote: > Hi, > > I have a Text Item that has the following FontInfo.Protection > > FontInfo.Protection := [rvprModifyProtect, > rvprConcateProtect, > rvprDoNotAutoSwitch]; > > Now suppose I have the following Items inside RichViewEdit, > > Name: [Insert here field NAME] > Address: [Insert here field ADDRESS] > > and that everything between '[' and ']' including them is my > text item with the protection above. > > Today if I click del or backspace nothing happens. > What I would like is when the user press DEL inside the brackets > everything is deleted. > > ???The correct way to delete the Item as whole when the user press <DEL> > inside the Item or when he press BackSpace wright after the item is > using ONKeyDown and OnKeyPress and testing if the user typed DEL or > BackSpaces inside the item and then delete the whole item ? > > Thanks > > Anderson |
Powered by ABC Amber Outlook Express Converter