Hello,
I want to know if there is something under the cursor (#9 (tAB), #13 (return - nothing), #32 (blank) or >#32 (alpha-numeric char) ... )
Cursor maybe in TDBrve (1.9.47) or rve-table.
I don't know how to get ItemNo (under the cursor), I don't know if I have to use GetItem or GetItemText or GetCurrentItemNo ...
I can't use memoMouseMove because I click a button after choosing the position in memo
(
if flagPt=false then pt:= memo.ClientToDocument(Point(X,Y)); //ohne flagPt kommt es durch die Rückkehr vom Image (pImage1) zu einem Fehler
if not memo.GetItemAt(pt.X, pt.Y, RVData, ItemNo, OffsInItem, True) then exit; // no item below the mouse cursor
)
Please help me.
Jürgen
ItemNo under cursor
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
CurItemNo property. It is an index of item in TopLevelEditor.
For example, text of the current item:
For example, text of the current item:
Code: Select all
if rve.TopLevelEditor.GetItemStyle(rve.TopLevelEditor.CurItemNo)>=0 then
s := rve.TopLevelEditor.GetItemText(rve.TopLevelEditor.CurItemNo)
else
s := ''; // non text
in the meantime I have solved my problem in this way:Sergey Tkachenko wrote:CurItemNo property. It is an index of item in TopLevelEditor.
For example, text of the current item:Code: Select all
if rve.TopLevelEditor.GetItemStyle(rve.TopLevelEditor.CurItemNo)>=0 then s := rve.TopLevelEditor.GetItemText(rve.TopLevelEditor.CurItemNo) else s := ''; // non text
memo.selectCurrentWord;
Memo.copyDef; s:= clipboard.astext;
memo.deselect;
if s='' then begin
...
end;
I think it's the same (?), but a workaround
How do you ask if s is underlined ?
My solution:
if btnUnderline.down=false then begin ...
procedure TForm1.btnUnderlineClick(Sender: TObject);
begin
if btnUnderline.down = True then Memo.ApplyStyleConversion(rv_MAKEUNDERLINE)
else Memo.ApplyStyleConversion(rv_CLEARUNDERLINE);
end;
I think there must be an easier solution.
OR
I want to get i in "if (fsUnderline in rvs.TextStyles.style)" without "for i := 0 to rvs.TextStyles.Count-1 do begin":
for i := 0 to rvs.TextStyles.Count-1 do begin
if (fsUnderline in rvs.TextStyles.style) and (rvs.TextStyles.Color = fa1) then
rvs.TextStyles.Color:= fa2; //blau wird grün
if (fsUnderline in rvs.TextStyles.style) and (rvs.TextStyles.Color = fa3) then
rvs.TextStyles.Color:= fa4; //von lime nach d_türkis
end;
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Do you need a current word or text of the current item? Item may consist of several words.
If a current word, it's not necessary to use the Clipboard (actually, application should not use the Clipboard except for Copy and Cut commands).
If a current word, it's not necessary to use the Clipboard (actually, application should not use the Clipboard except for Copy and Cut commands).
Code: Select all
memo.SelectCurrentWord
s := memo.GetSelText;
if s<>'' then
// word is selected, current text style is now style of the current item
IsUnderlined := fsUnderline in memo.Style.TextStyles[memo.CurTextStyleNo].Style
else
// no word at the caret position
IsUnderlined := False;