Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
setwintext append
#1
i work on a solution for drag and drop text.
ppro has a trigger middle drag left, it starts my macro.
Code:
Copy      Help
str s.getsel
s.setwintext(id(5001 "No Category"))

the selected text goes to a ppro note, where i want to collect text.
but how to append a new selection ?
currently with each new selection existing text will be replaced.
how to append ?

one way would be to read in a first step the note content and then to attach the new content.

typical weird from me, i know ...

here is what i really try to do :

i can't drop text from IE to a ppro note directly, but when pressing
control it works.
but as a lazy guy i don't want to press control,
a single mouse trigger should be enough.
pi
#2
well, the first way is easy (with append)
Code:
Copy      Help
str t.getwintext(id(5001 "+PowerProNote"))
int i = len(t)
str s.getsel
if i = 0
    s.setwintext(id(5001 "+PowerProNote"))
else
    str u.format("%s[]%s" t s)
    u.setwintext(id(5001 "+PowerProNote"))
pi
#3
pi Wrote:i can't drop text from IE to a ppro note directly, but when pressing
control it works.
but as a lazy guy i don't want to press control,
a single mouse trigger should be enough.

tada 8)
Code:
Copy      Help
lef+
key+ C
5 ML
key- C

its is triggered with left hold in ppro.
pi
#4
I am late but following may be useful in future.

With Edit and RichEdit controls you can use EM_ messages.
This appends text

Code:
Copy      Help
str s="text"

int h=id(5001 "+PowerProNote")

s+"[]"
SendMessage(h EM_SETSEL -2 -2)
SendMessage(h EM_REPLACESEL 0 s)

This gets line

Code:
Copy      Help
int lineindex=0
int h=id(5001 "+PowerProNote")

str s.all(300)
word* w=s; w[0]=300
s.fix(SendMessage(h EM_GETLINE lineindex s))
out s
#5

How would I remove the first line?
#6
From what?
#7

Sorry, from a RichEdit control.
#8
Send EM_LINEINDEX for line 1 (the second line), then send EM_EXSETSEL and EM_REPLACESEL.
#9

Im just a little bit lost do you think you could give me and example.

P.S Will this work if the id is read only.

#10

Ok my problem is that I have made a dialog and im using some of the above code to 'out' into a read only id (richedit) its some what like the out in QM, the problem is that id has a limit to how much text it can hold, that is fine with me but i would like to delete old outs that are not needed anymore so it doesnt reach the end of its limit.

This is the code I am using to out to the id
Code:
Copy      Help
function str's
int hwnd=id(5 "DlG")

s+"[]"
SendMessage(hwnd EM_SETSEL -2 -2)
SendMessage(hwnd EM_REPLACESEL 0 s)

I would like to add something that says if lines >100 delete top line first line.
#11

I got it thanks for the help, sorry Im slow sometimes :roll:


Code:
Copy      Help
function str's

int hwnd=id(5 "DlG")
if (SendMessage(hwnd EM_GETLINECOUNT 0 0))>100    
,SendMessage(hwnd EM_SETSEL 0 (SendMessage(hwnd EM_LINEINDEX 1 0)))
,SendMessage(hwnd EM_REPLACESEL 0 0)
s+"[]"
SendMessage(hwnd EM_SETSEL -2 -2)
SendMessage(hwnd EM_REPLACESEL 0 s)


Forum Jump:


Users browsing this thread: 1 Guest(s)