English
Source / code snippets

Richedit characters read in Stringvariable

 
- Page 1 -



RudiB.
Hello together,

i hope so can someone help....
i want one characters a Rich-Edit Window read and a Stringvariable transfer. Mark/select skin Yes there but then ??
this is my Lösungsansatz, functions only not.
Sendmessage(Rtf&,~EM_SETSEL,6,7)'--markiert the 7.th characters in the Richedit-Text
test$=Sendmessage(Rtf&,~EM_GETSEL,0,0)'--here should the characters z.B the characters "s" or. Chr$(115) read go, this standing too on position 7 in the Text
print Test$'--spending is "458758"
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
11/19/21  
 



« this Posting watts as Solution marked. »


RudiB.
Hello Georg,

super many Thanks...this is The Solution...
Declare x&,y&,y_neu&,testtext$,Richedit&,n$,area#,rtf#
Dim rtf#,84
Cls
Richedit&=Create("Richedit",%hwnd,"",20,20,600,300)
Testtext$="Declare test&,satz&,anzahl&,farb_anzahl&,superanzahl&,x&,y&,z&\n\
satz&=22\n\
anzahl&=44\n\
farb_anzahl&=100\n\
anzahl&=farb_anzahl&*30\n\
superanzahl&=anzahl&\n\
...\n\
...\n\
...\n\
etc. in the Listing"
SetText Richedit&,TestText$
n$="anzahl&"'--this Text should sought go(only to that example)
DIM area#,16
clear area#
x&=-1
y_neu&=-1

While 1

    Long area#,0=x&+1
    Long area#,4=-1
    Long area#,8=Addr(n$)
    x&=Sendmessage(Richedit&,$0438,2,area#)'--EM_FINDTEXT (2=Flagparameter for only whole Wörter search)
    Case x&=-1:BREAK
    y&=moeglichkeit_1_instr("_",GetText$(Richedit&),y_neu&)
    Sendmessage(Richedit&,$00B1,x&,x&+Len(n$))'--Cursor settle
    y_neu&=x&+Len(n$)

    Ifnot y&=x&

        rtf_SetColor RGB(255,0,0)

    Endif

    SetFocus(Richedit&)
    'Sleep 100

EndWhile

waitinput
Dispose area#
end

Proc rtf_SetColor

    Parameters a&
    Clear rtf#
    LONG rtf#,0=84
    LONG rtf#,4=$40000000
    LONG rtf#,20=a&
    sendmessage(Richedit&,1092,1,rtf#)'-EM_SETCHARFORMAT

ENDPROC

Proc moeglichkeit_1_instr

    Parameters such$,Text$,pos&
    InStr(such$,Text$,pos&)

ENDPROC


your first Solution with "Instr" is it...habs into Loop with installed.
PERFEKT.......sometimes sees one whom woods not sheer trees.

large thanks from munich
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
11/25/21  
 




Georg
Teles
good evening,

the EM_GETSEL markiert whom Text visible in the Edit, moreover must to the Edit zunchst fokusieren
CLS
var rtf& = Create("RichEdit", %hWnd, "Das is a small Test", 5, 5, 300, 300)
SetFocus(Rtf&)'first Fokus settle, before markiert becomes
Sendmessage(Rtf&,$00B1,6,7)'--markiert the 7.th characters in the Richedit-Text
waitinput

I have no idea what You very to have, so would I the solve:
CLS
var rtf& = Create("RichEdit", %hWnd, "Das is a small Test", 5, 5, 300, 300)
var Test$ = GetText$(rtf&)
print Mid$(test $,23,1)'markiert the latest s in the Text
waitinput
END

or umständlich:
CLS
declare Test#
dim Test#,100
var rtf& = Create("RichEdit", %hWnd, "Das is a small Test", 5, 5, 300, 300)
Sendmessage(Rtf&,$000D,100,Addr(Test#))
print Mid$(String $(Test#,0),23,1)'markiert the latest s in the Text
DisPose Test#
waitinput
END

Regards
 
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

11/23/21  
 




RudiB.
Hello Georg,
first time thanks for your response....
now To of my Problematik, have to a lauffähiges example appended.
i want in a Programmlisting to variables search...
now comes in this Listing The Variable "anzahl&" and "farb_anzahl&" to, I Search now only to "anzahl&" with the Suchoption 2 for only whole Wörter in FINDTEXT. here becomes but now too the "anzahl&" in the Variable "farb_anzahl&" with found/markiert, but should not so his.
therefore would like I a check the Zeichens to the Suchvariable manage.
means: if characters to Suchvariable = _ (Unterstrich) then markiere not.
there I had even on ~EM_GETTEXT virtual, kriegs but not there...
Declare x&,testtext$,Richedit&,n$,area#,rtf#
Dim rtf#,84
Cls
Richedit&=Create("Richedit",%hwnd,"",20,20,600,300)
Testtext$="Declare test&,satz&,anzahl&,farb_anzahl&,superanzahl&,x&,y&,z&\n\
satz&=22\n\
anzahl&=44\n\
farb_anzahl&=100\n\
anzahl&=farb_anzahl&*30\n\
superanzahl&=anzahl&\n\
...\n\
...\n\
...\n\
etc. in the Listing"
SetText Richedit&,TestText$
n$="anzahl&"'--this Text should sought go(only to that example)
DIM area#,16
clear area#
x&=-1

While 1

    Long area#,0=x&+1
    Long area#,4=-1
    Long area#,8=Addr(n$)
    x&=Sendmessage(Richedit&,$0438,2,area#)'--EM_FINDTEXT (2=Flagparameter for only whole Wörter search)
    Case x&=-1:BREAK
    Sendmessage(Richedit&,$00B1,x&,x&+Len(n$))'--Cursor settle
    rtf_SetColor RGB(255,0,0)
    SetFocus(Richedit&)
    'Sleep 100

EndWhile

SetFocus(Richedit&)
waitinput
Dispose area#
end

Proc rtf_SetColor

    Parameters a&
    Clear rtf#
    LONG rtf#,0=84
    LONG rtf#,4=$40000000
    LONG rtf#,20=a&
    sendmessage(Richedit&,1092,1,rtf#)'-EM_SETCHARFORMAT

ENDPROC

 
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
11/24/21  
 




Thomas
Freier
have time into Documentation the RTFHandling.pcu of Dieter Zornow seen, also with EM_FINDTEXT operates, but since were a Einschränkung, that only the first 64kb search go.
for More takes it The EM_FINDTEXTEX .
If (2=Flagparameter for only whole Wörter search) is correct, and Wortgebilde not ausschließt, would I do not only x&=-1 exit, separate on space, point and comma to and to the Suchtext Verify.
 
Gruß Thomas
Windows XP SP2, XProfan X2
11/25/21  
 




RudiB.
Hello Thomas,

to that one besagt the "X&=-1" Yes , the the document until end search becomes, or. the end the Dokuments access is.
useful is the the Return Value of Sendmessage with
x&=Sendmessage(Richedit&,$0438,2,area#

...and with all others Zeichencodes z.B comma,space etc. becomes it indeed correctly. recognized, even only at Unterstrich not.
the functions too with Texten larger as 64 KB.....

therefore Search I Yes to the Possibility the characters to the found Suchbegriff auszulesen.
but ~EM_GETSEL spit me only numbers from .....möglicherweise Speicheradressen, still How read I from ??????
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
11/25/21  
 




Georg
Teles
good evening,

I had as a Ansatz - for InStr and MemPos dürften no characters a problem his or no Completed: all characters give ... if You MemPos still in the Loop umsetzen can, can you neither druckbare characters search, there i was To rotten a Proc for you To write :/
Declare x&,testtext$,Richedit&,n$,area#,rtf#
Dim rtf#,84
Cls
Richedit&=Create("Richedit",%hwnd,"",20,20,600,300)
Testtext$="Declare test&,satz&,anzahl&,farb_anzahl&,superanzahl&,x&,y&,z&\n\
satz&=22\n\
anzahl&=44\n\
farb_anzahl&=100\n\
anzahl&=farb_anzahl&*30\n\
superanzahl&=anzahl&\n\
...\n\
...\n\
...\n\
etc. in the Listing"
SetText Richedit&,TestText$
n$="anzahl&"'--this Text should sought go(only to that example)
DIM area#,16
clear area#
x&=-1

While 1

    Long area#,0=x&+1
    Long area#,4=-1
    Long area#,8=Addr(n$)
    x&=Sendmessage(Richedit&,$0438,2,area#)'--EM_FINDTEXT (2=Flagparameter for only whole Wörter search)
    Case x&=-1:BREAK
    Sendmessage(Richedit&,$00B1,x&,x&+Len(n$))'--Cursor settle
    rtf_SetColor RGB(255,0,0)
    SetFocus(Richedit&)
    'Sleep 100

EndWhile

' InStr benefit: can itself a Loop form, d.h. position,
' ex the huier sought becomes, begins with -1 ... with gefundenem Result can
' to gefudenen position +1 dazugezählt and be a new Search launched go, as long as
' the Result not The previous Suchposition was
print "1. Result 1. function: "+Str $(moeglichkeit_1_instr("farb_",GetText$(Richedit&),-1))
' too well, problematically Better get going with the position, these must always -1 his,
' there the MemPos only whom first Fund outputs
' the can vermeinden, if The Textvariable circa ex the found position + length gekürzt becomes
' and ex the position -1 weitergesucht + The length and the previous position the abgeschnittenen Strings hinzugezählt go must !
print "1. Result 2. function: "+Str $(moeglichkeit_2_mempos("farb_",GetText$(Richedit&),-1))
print "-------------------------------------------------------------"
' InStr in Loop
moeglichkeit_1_instr_schleife("farb_",GetText$(Richedit&),-1)
print "-------------------------------------------------------------"
' here there nothing To see :/
moeglichkeit_2_mempos_schleife("farb_",GetText$(Richedit&),-1)
'SetFocus(Richedit&)
waitinput
Dispose area#
end

Proc rtf_SetColor

    Parameters a&
    Clear rtf#
    LONG rtf#,0=84
    LONG rtf#,4=$40000000
    LONG rtf#,20=a&
    sendmessage(Richedit&,1092,1,rtf#)'-EM_SETCHARFORMAT

ENDPROC

Proc moeglichkeit_1_instr

    Parameters such$,Text$,pos&
    InStr(such$,Text$,pos&)

ENDPROC

Proc moeglichkeit_2_mempos

    Parameters such$,Text$,pos&
    declare Text#, p&
    dim Text#, len(text $)
    char Text#,0 = Text$
    p& = MemPos(Text#,pos&,such$)
    DisPose Text#
    Return p&

ENDPROC

Proc moeglichkeit_1_instr_schleife

    Parameters such$,Text$,pos&
    declare end%, laufvar&, var&, i%
    end% = 0
    var& = -2
    laufvar& = -2
    i% = 0

    WhileNot end%

        var& = Str $(moeglichkeit_1_instr("farb_",GetText$(Richedit&),laufvar&))

        Ifnot ((laufvar&+1) < var&)

            print "#--- No further hits found ---#"
            break

        EndIf

        laufvar& = var&+1
        inc i%
        print Str $(i%)+". found position Loop: "+Str $(var&)

    EndWhile

ENDPROC

Proc moeglichkeit_2_mempos_schleife

    Parameters such$,Text$,pos&
    print "war To rotten, a Proc To write, the hoisted is To big\nder Text must zugeschnitten go until previous hits + length\ndes textes and at next Ergebniss must these previous position + length\nzur new found position dazugerechnet go :/"
    Return

ENDPROC


Regards
 
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

11/25/21  
 




RudiB.
Hello Georg,

super many Thanks...this is The Solution...
Declare x&,y&,y_neu&,testtext$,Richedit&,n$,area#,rtf#
Dim rtf#,84
Cls
Richedit&=Create("Richedit",%hwnd,"",20,20,600,300)
Testtext$="Declare test&,satz&,anzahl&,farb_anzahl&,superanzahl&,x&,y&,z&\n\
satz&=22\n\
anzahl&=44\n\
farb_anzahl&=100\n\
anzahl&=farb_anzahl&*30\n\
superanzahl&=anzahl&\n\
...\n\
...\n\
...\n\
etc. in the Listing"
SetText Richedit&,TestText$
n$="anzahl&"'--this Text should sought go(only to that example)
DIM area#,16
clear area#
x&=-1
y_neu&=-1

While 1

    Long area#,0=x&+1
    Long area#,4=-1
    Long area#,8=Addr(n$)
    x&=Sendmessage(Richedit&,$0438,2,area#)'--EM_FINDTEXT (2=Flagparameter for only whole Wörter search)
    Case x&=-1:BREAK
    y&=moeglichkeit_1_instr("_",GetText$(Richedit&),y_neu&)
    Sendmessage(Richedit&,$00B1,x&,x&+Len(n$))'--Cursor settle
    y_neu&=x&+Len(n$)

    Ifnot y&=x&

        rtf_SetColor RGB(255,0,0)

    Endif

    SetFocus(Richedit&)
    'Sleep 100

EndWhile

waitinput
Dispose area#
end

Proc rtf_SetColor

    Parameters a&
    Clear rtf#
    LONG rtf#,0=84
    LONG rtf#,4=$40000000
    LONG rtf#,20=a&
    sendmessage(Richedit&,1092,1,rtf#)'-EM_SETCHARFORMAT

ENDPROC

Proc moeglichkeit_1_instr

    Parameters such$,Text$,pos&
    InStr(such$,Text$,pos&)

ENDPROC


your first Solution with "Instr" is it...habs into Loop with installed.
PERFEKT.......sometimes sees one whom woods not sheer trees.

large thanks from munich
 
XProfan X4
Xprofan X4
Rudolf Beske / München

Hardware: NB Intel I9 - 16GByte RAM
11/25/21  
 




Georg
Teles
Yes perfect,

oh, I have but Mist posted, have überlesen, what You konkret wanted seh today too whom woods not sheer trees - to that target has But led hehehehehe

Regards from the bathe-Württembergischer / Bayrischer boundary (Ulm)
 
XProfan X2
TC-Programming [...] 
XProfan 8.0 - 10.0 - X2 - X3 - X4

11/25/21  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.486 Views

Untitledvor 0 min.
Rockford07/31/24
Erhard Wirth06/14/24
Sven Bader11/18/23
Uwe Starke11/17/23
More...

Themeninformationen



Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie