Dragon Naturally Speaking 9.5
Dragon Naturally Speaking 9.5
We would like to use Dragon Naturally Speaking to dictate text into TRichView-Components (Ver. 1.9.24) .
We changed some entries in nsapps.ini (Dragon) like
TDBRichViewEdit=4. This entry tells the Dragon software that this field is a Richtext-Field. We made the same entry for TDBMemo which is working all right. Working means, that the field is recognized from the Dragon software as a standard-window.
We changed some entries in nsapps.ini (Dragon) like
TDBRichViewEdit=4. This entry tells the Dragon software that this field is a Richtext-Field. We made the same entry for TDBMemo which is working all right. Working means, that the field is recognized from the Dragon software as a standard-window.
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
TDBMemo uses standard edit control, so external applications must know how to get text from it. But TDBRichViewEdit is not a standard richedit control, so probably it will not work.
It depends on how this software gets text from control. It may use window messages. If it uses WM_GETTEXT, it will not work (this message is supported only if you use Delphi 7 or older; in new versions of Delphi, support for this message is disabled because it conflicts with VCL implementation). If it uses EM_GETTEXTRANGE, it may work.
It depends on how this software gets text from control. It may use window messages. If it uses WM_GETTEXT, it will not work (this message is supported only if you use Delphi 7 or older; in new versions of Delphi, support for this message is disabled because it conflicts with VCL implementation). If it uses EM_GETTEXTRANGE, it may work.
Hi Sergey
We found some news about the Dragon implementation:
We found some news about the Dragon implementation:
So there would be a chance to implement TRichView if it uses MSAA? How can we do that?if you want to make your application Select-and-Say compatible with DNS 9, make sure that your application both supports MSAA and that all Windows that support dictation use Text Services Framework.
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Dragon Naturally Speaking 9.5
Hello,
it's possible to tells Dragon that TRichViewEdit is compatible in nsapps.ini
but then TRichViewEdit needs to support more EM_xx messages
for now, my test do not work but here is my code
the messages are not the same according to the value set in the ini
http://nuance.custhelp.com/app/answers/ ... for-dragon
it's possible to tells Dragon that TRichViewEdit is compatible in nsapps.ini
Code: Select all
[.Global\Global Enable Class Names]
RICHEDIT=2
RichEdit20A=3
RichEdit20W=4
RichEdit20WPT=4
RichEdit50W=4
RichEdit60W=4
Edit=1
TEdit=1
TMemo=1
REComboBox20W=1
TRichEdit=2
RichTextWndClass=2
TRichViewEdit=1
for now, my test do not work but here is my code
the messages are not the same according to the value set in the ini
http://nuance.custhelp.com/app/answers/ ... for-dragon
Code: Select all
procedure TRichViewEdit.EMExGetSel(var Msg: TMessage);
var
SelStart, SelLength: Integer;
CharRange: ^TCharRange;
begin
RVGetSelection(Self, SelStart, SelLength);
CharRange := Pointer(Msg.LParam);
if SelLength >= 0 then
begin
CharRange.cpMin := SelStart;
CharRange.cpMax := SelStart + SelLength;
end else begin
CharRange.cpMin := SelStart + SelLength;
CharRange.cpMax := SelStart;
end;
end;
procedure TRichViewEdit.EMGetFirstVisibleLine(var Msg: TMessage);
begin
Msg.Result := Self.GetLineNo(Self.GetFirstItemVisible, 0) - 1;
end;
procedure TRichViewEdit.EMGetLineCount(var Msg: TMessage);
begin
Msg.Result := Self.LineCount;
end;
procedure TRichViewEdit.EMLineFromChar(var Msg: TMessage);
var
Item, Ofs: Integer;
DT: TCustomRVData;
begin
if NativeInt(Msg.WParam) = -1 then
begin
Item := Self.CurItemNo;
Ofs := 0;
end else begin
LinearToRichView(Self, Self.RVData, Integer(Msg.WParam), DT, Item, Ofs);
end;
Msg.Result := Self.GetLineNo(Item, 0);
end;
procedure TRichViewEdit.EMPosFromChar(var Msg: TMessage);
var
Item, Ofs: Integer;
Left, Top: Integer;
DT: TCustomRVData;
PL: PPointL;
begin
PL := Pointer(Msg.WParam);
if IsBadWritePtr(PL, SizeOf(TPointL)) then
begin
LinearToRichView(Self, Self.RVData, Integer(Msg.WParam), DT, Item, Ofs);
Self.GetItemCoords(Item, Left, Top);
Msg.Result := MakeLong(Left, Top);
end else begin
LinearToRichView(Self, Self.RVData, Integer(Msg.LParam), DT, Item, Ofs);
Self.GetItemCoords(Item, PL.x, PL.Y);
end;
end;
procedure TRichViewEdit.EMGetCharFormat(var Msg: TMessage);
var
Format: ^CHARFORMAT2;
Style: TFontInfo;
begin
Format := Pointer(Msg.LParam);
if Format.cbSize >= SizeOf(CHARFORMAT) then
begin
Format.dwMask := CFM_BOLD or CFM_ITALIC or CFM_STRIKEOUT or CFM_UNDERLINE;
Format.dwEffects := 0;
Style := Self.Style.TextStyles[Self.CurTextStyleNo];
if fsBold in Style.Style then
Format.dwEffects := Format.dwEffects or CFE_BOLD;
if fsItalic in Style.Style then
Format.dwEffects := Format.dwEffects or CFE_ITALIC;
if fsStrikeOut in Style.Style then
Format.dwEffects := Format.dwEffects or CFE_STRIKEOUT;
if fsUnderline in Style.Style then
Format.dwEffects := Format.dwEffects or CFE_UNDERLINE;
end;
end;
procedure TRichViewEdit.EMExSetSel(var Msg: TMessage);
var
CharRange: ^TCharRange;
begin
CharRange := Pointer(Msg.LParam);
if CharRange.cpMin = CharRange.cpMax then
Deselect
else
if (CharRange.cpMin = 0) and (CharRange.cpMax = -1) then
SelectAll
else
RVSetSelection(Self, CharRange.cpMin,
CharRange.cpMax - CharRange.cpMin);
Invalidate;
Msg.Result := MakeLong(CharRange.cpMin, CharRange.cpMax);
end;
procedure TRichViewEdit.EMReplaceSel(var Msg: TMessage);
begin
Self.InsertText(PChar(Msg.LParam));
end;
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Dragon Naturally Speaking 9.5
The new version of TRIchView supports the following edit/richedit messages:
EM_GETSEL, EM_SETSEL, EM_GETTEXTRANGE, EM_LINEFROMCHAR, EM_EXLINEFROMCHAR, EM_LINELENGTH, EM_LINEINDEX, WM_GETTEXTLENGTH, WM_GETTEXT, WM_SETTEXT.
There is one important thing that I was not able to find in Windows documentation, but found by experiments: how many characters are in line breaks?
As I found, in WM_* messages above, line breaks are counted as 2 characters both in Edit and RichEdit.
But for EM_* messages, there is a difference: line breaks are counted as 2 characters in Edit, but as 1 character in RichEdit.
TRichView uses 2 characters per line break in these events, so it makes sense to introduce it as an Edit, not as a RichEdit. Because of this, messages specific for RichEdits become unnecessary.
EM_GETSEL, EM_SETSEL, EM_GETTEXTRANGE, EM_LINEFROMCHAR, EM_EXLINEFROMCHAR, EM_LINELENGTH, EM_LINEINDEX, WM_GETTEXTLENGTH, WM_GETTEXT, WM_SETTEXT.
There is one important thing that I was not able to find in Windows documentation, but found by experiments: how many characters are in line breaks?
As I found, in WM_* messages above, line breaks are counted as 2 characters both in Edit and RichEdit.
But for EM_* messages, there is a difference: line breaks are counted as 2 characters in Edit, but as 1 character in RichEdit.
TRichView uses 2 characters per line break in these events, so it makes sense to introduce it as an Edit, not as a RichEdit. Because of this, messages specific for RichEdits become unnecessary.
Re: Dragon Naturally Speaking 9.5
with last version of RVEditDemo.exe, if I set TRichViewEdit=1 (3 or 4), I have a access violation error at 0040712C
I guess it's about EM_POSFROMCHAR when Msg.WParam is not a Pointer to a TPointL structure but a 0 based char index.
If I set TRichViewEdit=2, and I ask Dragon to set text in bold, I have a very strange error with a dialogbox.
the title is "dd10edit"
and the french text talk about COM error HOOKERR_CANNOTINJECT
I guess it's about EM_POSFROMCHAR when Msg.WParam is not a Pointer to a TPointL structure but a 0 based char index.
If I set TRichViewEdit=2, and I ask Dragon to set text in bold, I have a very strange error with a dialogbox.
the title is "dd10edit"
and the french text talk about COM error HOOKERR_CANNOTINJECT
-
- Site Admin
- Posts: 17522
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Dragon Naturally Speaking 9.5
EM_POSFROMCHAR is not processed by TRichView at all, so probably the error is in another message.
Unfortunately, I do not have DNS to check.
Unfortunately, I do not have DNS to check.
-
- Posts: 2
- Joined: Wed Jun 02, 2021 8:53 am
Re: Dragon Naturally Speaking 9.5
Hello,
I'm still playing with the Dragon
to implement EM_POSTFROMCHAR I need to return the pixel position of the nth character for the text
I've made a quick test with TMemo with a the text "test"
I guess I could use LinearToRichView and Item2DrawItem but I don't see how to get individual character position.
Thanks
for information, here a the notable message when Dragon add a text "test" in a TMemo, select the text and make it bold (Ctrl+G with the french term "Gras")
I'm still playing with the Dragon
to implement EM_POSTFROMCHAR I need to return the pixel position of the nth character for the text
I've made a quick test with TMemo with a the text "test"
Code: Select all
EM_POSFROMCHAR -1, 0 returns $FFFFFFFF
EM_POSFROMCHAR 0, 0 returns MakeLong(1, 4)
EM_POSFROMCHAR 1, 0 returns MakeLong(1, 10)
EM_POSFROMCHAR 2, 0 returns MakeLong(1, 16)
EM_POSFROMCHAR 3, 0 returns MakeLong(1, 22)
EM_POSFROMCHAR 4, 0 returns $FFFFFFFF
Thanks
for information, here a the notable message when Dragon add a text "test" in a TMemo, select the text and make it bold (Ctrl+G with the french term "Gras")
Code: Select all
[MEMO: 09:57:16] WM_GETTEXTLENGTH 0x0000 0x0000 -> 0
[MEMO: 09:57:16] EM_GETSEL 0x18FB94 0x18FB98 -> 0, 0 / 0, 0
[MEMO: 09:57:16] EM_GETFIRSTVISIBLELINE 0x0000 0x0000 -> 0
[MEMO: 09:57:16] EM_GETLINECOUNT 0x0000 0x0000 -> 1
[MEMO: 09:57:16] WM_GETTEXTLENGTH 0x0000 0x0000 -> 0
[MEMO: 09:57:16] EM_GETSEL 0x18FB54 0x18FB58 -> 0, 0 / 0, 0
[MEMO: 09:57:16] EM_LINEFROMCHAR 0x0000 0x0000 -> 0
[MEMO: 09:57:16] EM_LINEFROMCHAR 0x0000 0x0000 -> 0
[MEMO: 09:57:16] EM_POSFROMCHAR 0x0000 0x0000 -> 65535, 65535
[MEMO: 09:57:16] WM_GETTEXTLENGTH 0x0000 0x0000 -> 0
[MEMO: 09:57:16] WM_GETTEXT 0x0100 0x18EB8C ->
[MEMO: 09:57:17] EM_SETSEL 0, 0
[MEMO: 09:57:17] EM_REPLACESEL 0x0001 0x58D002C "Test"
[MEMO: 09:57:17] EM_SETSEL 4, 4
[MEMO: 09:57:17] EM_GETSEL 0x18FB94 0x18FB98 -> 4, 4 / 4, 4
[MEMO: 09:57:17] EM_GETFIRSTVISIBLELINE 0x0000 0x0000 -> 0
[MEMO: 09:57:17] EM_GETLINECOUNT 0x0000 0x0000 -> 1
[MEMO: 09:57:17] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:17] EM_GETSEL 0x18FB54 0x18FB58 -> 4, 4 / 4, 4
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:17] EM_POSFROMCHAR 0x0004 0x0000 -> 65535, 65535
[MEMO: 09:57:17] EM_POSFROMCHAR 0x0003 0x0000 -> 1, 21
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0003 0x0000 -> 0
[MEMO: 09:57:17] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:17] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:17] EM_GETSEL 0x18FB94 0x18FB98 -> 4, 4 / 4, 4
[MEMO: 09:57:17] EM_GETFIRSTVISIBLELINE 0x0000 0x0000 -> 0
[MEMO: 09:57:17] EM_GETLINECOUNT 0x0000 0x0000 -> 1
[MEMO: 09:57:17] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:17] EM_GETSEL 0x18FB54 0x18FB58 -> 4, 4 / 4, 4
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:17] EM_POSFROMCHAR 0x0004 0x0000 -> 65535, 65535
[MEMO: 09:57:17] EM_POSFROMCHAR 0x0003 0x0000 -> 1, 21
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:17] EM_LINEFROMCHAR 0x0003 0x0000 -> 0
[MEMO: 09:57:17] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:17] WM_GETTEXT 0x0104 0x18EB8C -> Test
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_WINDOW -> $0000
[MEMO: 09:57:17] WM_GETOBJECT 0x0000 OBJID_QUERYCLASSNAMEIDX -> $10004
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_SYSMENU -> $0000
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_TITLEBAR -> $0000
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_MENU -> $0000
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_CLIENT -> $0000
[MEMO: 09:57:17] WM_GETOBJECT 0x0000 OBJID_QUERYCLASSNAMEIDX -> $10004
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_VSCROLL -> $0000
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_HSCROLL -> $0000
[MEMO: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_SIZEGRIP -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_WINDOW -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0x0000 OBJID_QUERYCLASSNAMEIDX -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_SYSMENU -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_TITLEBAR -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_MENU -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_CLIENT -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0x0000 OBJID_QUERYCLASSNAMEIDX -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_VSCROLL -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_HSCROLL -> $0000
[RVE: 09:57:17] WM_GETOBJECT 0xFFFFFFFF OBJID_SIZEGRIP -> $0000
[MEMO: 09:57:18] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:18] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:18] EM_GETSEL 0x18FB94 0x18FB98 -> 4, 4 / 4, 4
[MEMO: 09:57:18] EM_GETFIRSTVISIBLELINE 0x0000 0x0000 -> 0
[MEMO: 09:57:18] EM_GETLINECOUNT 0x0000 0x0000 -> 1
[MEMO: 09:57:18] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:18] EM_GETSEL 0x18FB54 0x18FB58 -> 4, 4 / 4, 4
[MEMO: 09:57:18] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:18] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:18] EM_POSFROMCHAR 0x0004 0x0000 -> 65535, 65535
[MEMO: 09:57:18] EM_POSFROMCHAR 0x0003 0x0000 -> 1, 21
[MEMO: 09:57:18] EM_LINEFROMCHAR 0x0004 0x0000 -> 0
[MEMO: 09:57:18] EM_LINEFROMCHAR 0x0003 0x0000 -> 0
[MEMO: 09:57:18] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:18] WM_GETTEXT 0x0104 0x18EB8C -> Test
[MEMO: 09:57:18] EM_SETSEL 0, 4
[MEMO: 09:57:18] EM_GETSEL 0x18FB94 0x18FB98 -> 0, 4 / 4, 0
[MEMO: 09:57:18] EM_GETFIRSTVISIBLELINE 0x0000 0x0000 -> 0
[MEMO: 09:57:18] EM_GETLINECOUNT 0x0000 0x0000 -> 1
[MEMO: 09:57:18] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:18] EM_GETSEL 0x18FB54 0x18FB58 -> 0, 4 / 4, 0
[MEMO: 09:57:18] EM_LINEFROMCHAR 0x0000 0x0000 -> 0
[MEMO: 09:57:18] EM_LINEFROMCHAR 0x0003 0x0000 -> 0
[MEMO: 09:57:18] EM_POSFROMCHAR 0x0000 0x0000 -> 1, 4
[MEMO: 09:57:19] WM_KEYDOWN 0x0011 0x1D0001 VK_CONTROL -> $0001
[MEMO: 09:57:19] WM_KEYDOWN 0x0047 0x220001 G -> $0001
[MEMO: 09:57:19] WM_CHAR 0x0007 0x220001 -> $0001
[MEMO: 09:57:19] WM_KEYUP 0x0047 0xC0220001 G -> $0000
[MEMO: 09:57:19] WM_KEYUP 0x0011 0xC01D0001 VK_CONTROL -> $0000
[MEMO: 09:57:19] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:19] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:19] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:19] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:19] EM_GETSEL 0x18FB94 0x18FB98 -> 0, 4 / 4, 0
[MEMO: 09:57:19] EM_GETFIRSTVISIBLELINE 0x0000 0x0000 -> 0
[MEMO: 09:57:19] EM_GETLINECOUNT 0x0000 0x0000 -> 1
[MEMO: 09:57:19] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:19] EM_GETSEL 0x18FB54 0x18FB58 -> 0, 4 / 4, 0
[MEMO: 09:57:19] EM_LINEFROMCHAR 0x0000 0x0000 -> 0
[MEMO: 09:57:19] EM_LINEFROMCHAR 0x0003 0x0000 -> 0
[MEMO: 09:57:19] EM_POSFROMCHAR 0x0000 0x0000 -> 1, 4
[MEMO: 09:57:19] WM_GETTEXTLENGTH 0x0000 0x0000 -> 4
[MEMO: 09:57:19] WM_GETTEXT 0x0104 0x18EB8C -> Test
[MEMO: 09:57:19] EM_SETSEL 4, 4
-
- Posts: 2
- Joined: Wed Jun 02, 2021 8:53 am
Re: Dragon Naturally Speaking 9.5
Hello,
Finally I got it working
1) add TRichViewEdit=1 in nsapps.ini
2) handle this messages
For Dragon Medical One, you have to use the Standalone version and change SOD.exe.Config to add a TextControlMappings section inside ApplicationSettings to map TRichViewEdit to a TMemo
Finally I got it working
1) add TRichViewEdit=1 in nsapps.ini
2) handle this messages
Code: Select all
TRichViewEdit = class(RVEdit.TRichViewEdit)
private
FLastPos: Integer;
FLastChar: Integer;
FLastLen: Integer;
FLastText: string;
procedure EMReplaceSel(var Msg: TMessage); message EM_REPLACESEL;
procedure EMPosFromChar(var Msg: TMessage); message EM_POSFROMCHAR;
procedure WMGetTextLength(var Message: TMessage); message WM_GETTEXTLENGTH;
procedure WMGetText(var Message: TMessage); message WM_GETTEXT;
procedure WMSetText(var Message: TMessage); message WM_SETTEXT;
protected
procedure DoChange(ClearRedo: Boolean); override;
function
function IsEmpty: Boolean;
end;
procedure TRichViewEdit.EMReplaceSel(var Msg: TMessage);
begin
InsertText(PChar(Msg.LParam));
end;
procedure TRichViewEdit.EMPosFromChar(var Msg: TMessage);
var
DT: TCustomRVData;
Item, Ofs: Integer;
DItem, DOfs: Integer;
begin
Msg.Result := -1;
if FLastLen < 0 then
FLastLen := RVGetTextLength(Self);
if (not IsEmpty) and (Integer(Msg.WParam) < FLastLen) then
begin
if Integer(Msg.WParam) = FLastPos then
Msg.Result := FLastChar
else begin
FLastPos := Integer(Msg.WParam);
if LinearToRichView(Self, Self.RVData, FLastPos, DT, Item, Ofs) then
begin
Self.TopLevelEditor.RVData.Item2DrawItem(Item, Ofs, DItem, DOfs);
if DItem >= 0 then
begin
Left := Self.TopLevelEditor.RVData.DrawItems[DItem].Left + DOfs;
Top := Self.TopLevelEditor.RVData.DrawItems[DItem].Top;
Msg.Result := MakeLong(Top, Left);
end;
end;
FLastChar := Msg.Result;
end;
end;
end;
procedure TRichViewEdit.WMGetTextLength(var Message: TMessage);
begin
if FLastLen < 0 then
begin
if IsEmpty then
FLastLen := 0
else
FLastLen := RVGetTextLength(Self);
end;
Message.Result := FLastLen
end;
procedure TRichViewEdit.WMGetText(var Message: TMessage);
var
Len: Integer;
begin
if FLastText = #0 then
begin
FLastText := RVGetTextRange(Self, 0, -1);
end;
if (Message.WParam <= 0) or (FLastText = '') then
Message.Result := 0
else begin
Len := Length(FLastText) + 1;
if Message.WParam < WPARAM(Len) then
Len := Message.WParam;
if Message.LParam <> 0 then
Move(PChar(FLastText)^, Pointer(Message.LParam)^, Len * SizeOf(Char));
Message.Result := Len - 1;
end;
end;
procedure TRichViewEdit.WMSetText(var Message: TMessage);
begin
Clear;
AddTextNL(PChar(Message.LParam), 0, 0, 0);
Format;
Message.Result := 1;
end;
function TRichViewEdit.IsEmpty: Boolean;
begin
Result := (csDestroying in ComponentState) or (ItemCount = 0) or ((ItemCount = 1) and (GetItemStyle(0) >= 0) and (GetItemText(0)= ''));
end;
procedure TRichViewEdit.DoChange(ClearRedo: Boolean);
begin
// Note that "Dragon Medical One" send EM_LINEFROMCHAR, EM_POSFROMCHAR, WM_GETTEXT, WM_GETTEXTLENGTH, WM_GETSEL...
// mutltiple times per second and TRichEdit is blinking ! so I keep the last computed values until DoChange is called
inherited;
FLastPos := -1;
FLastLen := -1;
FLastText := #0;
end;
Code: Select all
<applicationSettings>
...
<TextControlMappings>
<TextControlMapping Control="TMemo">
<WindowClass>TRichViewEdit</WindowClass>
</TextControlMapping>
</TextControlMappings>
</applicationSettings>
Re: Dragon Naturally Speaking 9.5
damned ! the flickering is back :/ since I've updated to last version of RV (from an old version)
I have to dig into the methods...
when Dragon Medical One is active I have this messages permanently
Sergey, have you any idea of what can produce a move/paint in that messages ?
I have to dig into the methods...
when Dragon Medical One is active I have this messages permanently
Code: Select all
procedure TRichViewEdit.WndProc(var Msg: TMessage);
begin
{
[DRAGON] EM_POSFROMCHAR 463, 0 : 65562
[DRAGON] WM_GETFONT 0, 0 : 0
[DRAGON] WM_GETTEXTLENGTH 0, 0 : 567
[DRAGON] WM_GETTEXT 568, 1697740 : 567
[DRAGON] WM_GETTEXT 1079, 1697740 : 567
[DRAGON] WM_PAINT 0, 0 : 0
[DRAGON] WM_GETTEXTLENGTH 0, 0 : 567
[DRAGON] WM_GETTEXT 568, 1697852 : 567
[DRAGON] EM_GETSEL 220064896, 220064900 : 30343631
[DRAGON] EM_GETSEL 1702336, 1702324 : 30343631
[DRAGON] EM_LINEFROMCHAR 463, 0 : 16
[DRAGON] EM_LINEFROMCHAR 463, 0 : 16
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700956 : 0
[DRAGON] WM_MOVE 0, 1835016 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700956 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700516 : 0
[DRAGON] WM_NCPAINT 1057236589, 0 : 0
[DRAGON] WM_ERASEBKGND 352395496, 0 : 1
[DRAGON] WM_MOVE 0, 1835011 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700516 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700956 : 0
[DRAGON] WM_NCPAINT 1308894829, 0 : 0
[DRAGON] WM_ERASEBKGND 771824417, 0 : 1
[DRAGON] WM_MOVE 0, 18677763 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700956 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700516 : 0
[DRAGON] WM_NCPAINT 1594107501, 0 : 0
[DRAGON] WM_ERASEBKGND 3120636672, 0 : 1
[DRAGON] WM_MOVE 0, 1835011 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700516 : 0
[DRAGON] EM_POSFROMCHAR 463, 0 : 65562
[DRAGON] WM_GETFONT 0, 0 : 0
[DRAGON] WM_GETTEXTLENGTH 0, 0 : 567
[DRAGON] WM_GETTEXT 568, 1697740 : 567
[DRAGON] WM_GETTEXT 1079, 1697740 : 567
[DRAGON] WM_PAINT 0, 0 : 0
[DRAGON] WM_GETTEXTLENGTH 0, 0 : 567
[DRAGON] WM_GETTEXT 568, 1697852 : 567
[DRAGON] EM_GETSEL 220064896, 220064900 : 30343631
[DRAGON] EM_GETSEL 1702336, 1702324 : 30343631
[DRAGON] EM_LINEFROMCHAR 463, 0 : 16
[DRAGON] EM_LINEFROMCHAR 463, 0 : 16
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700956 : 0
[DRAGON] WM_MOVE 0, 1835016 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700956 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700516 : 0
[DRAGON] WM_NCPAINT 3607374263, 0 : 0
[DRAGON] WM_ERASEBKGND 738272853, 0 : 1
[DRAGON] WM_MOVE 0, 1835011 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700516 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700956 : 0
[DRAGON] WM_NCPAINT 3859032503, 0 : 0
[DRAGON] WM_ERASEBKGND 3120636672, 0 : 1
[DRAGON] WM_MOVE 0, 18677763 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700956 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700516 : 0
[DRAGON] WM_NCPAINT 4177799607, 0 : 0
[DRAGON] WM_ERASEBKGND 352395496, 0 : 1
[DRAGON] WM_MOVE 0, 1835011 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700516 : 0
}
inherited;
WriteLn('[DRAGON] ', MessageName(Msg.Msg):20, ' ', Msg.wParam:15, ', ', Msg.lParam:15, ' : ', Msg.Result:15);
end;
Re: Dragon Naturally Speaking 9.5
hum...it seems that LinearToRichView is the source of the pb
my patch was to avoid a second call when the last computed value is known but it doesn't work anymore
my patch was to avoid a second call when the last computed value is known but it doesn't work anymore
Code: Select all
[DRAGON] WM_GETTEXTLENGTH 0, 0 : 570
[DRAGON] WM_GETTEXT 571, 1697724 : 570
[DRAGON] WM_GETTEXT 1082, 1697724 : 570
[DRAGON] WM_PAINT 0, 0 : 0
[DRAGON] WM_GETTEXTLENGTH 0, 0 : 570
[DRAGON] WM_GETTEXT 571, 1697836 : 570
[DRAGON] EM_GETSEL 254365200, 254365204 : 26608022 => (406, 406)
[DRAGON] EM_GETSEL 1702352, 1702340 : 26608022
[DRAGON] EM_LINEFROMCHAR 406, 0 : 11
[DRAGON] EM_LINEFROMCHAR 406, 0 : 11
[CAPTURE] EMPosFromChar (FLastLen = 570)
> LinearToRichView for 406
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700924 : 0
[DRAGON] WM_MOVE 0, 1835023 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700924 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700484 : 0
[DRAGON] WM_NCPAINT 772021604, 0 : 0
[DRAGON] WM_ERASEBKGND 3993061038, 0 : 1
[DRAGON] WM_MOVE 0, 1835011 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700484 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700924 : 0
[DRAGON] WM_NCPAINT 822353252, 0 : 0
[DRAGON] WM_ERASEBKGND 3288402874, 0 : 1
[DRAGON] WM_MOVE 0, 13107203 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700924 : 0
[DRAGON] WM_WINDOWPOSCHANGING 0, 1700484 : 0
[DRAGON] WM_NCPAINT 889462116, 0 : 0
[DRAGON] WM_ERASEBKGND 3993061038, 0 : 1
[DRAGON] WM_MOVE 0, 1835011 : 0
[DRAGON] WM_WINDOWPOSCHANGED 0, 1700484 : 0
[DRAGON] EM_POSFROMCHAR 406, 0 : 65562