Post by tsh73 on Aug 4, 2022 5:00:41 GMT -5
It looks like in LB 4.5.1 "!paste" sometimes go to wrong texteditor
actually in active one
Workaround:
you can manually setfocus before paste and return focus back.
Possible way of knowing where "back" (active control) is could be got by API call.
Instructions:
put the program in LB
copy to clipboard single word
run program
After timer fires, clipboard text should appear in lower textbox
Now click in that textbox
PASTE that should work on upper textbox somehow adds text to lower one
actually in active one
Workaround:
you can manually setfocus before paste and return focus back.
Possible way of knowing where "back" (active control) is could be got by API call.
Instructions:
put the program in LB
copy to clipboard single word
run program
After timer fires, clipboard text should appear in lower textbox
Now click in that textbox
PASTE that should work on upper textbox somehow adds text to lower one
'nomainwin
WindowWidth = 550
WindowHeight = 410
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
button #main.button1, "readClipboard", [button1Click], UL, 26, 116, 122, 25
texteditor #main.hiddenOffScreenTxt, 0, 0, 500, 100
texteditor #main.log, 22, 151, 500, 300
menu #main, "Edit" '<--- Texteditor Menu can be moved but not removed.
open "read Clipboard demo" for window as #main
print #main, "trapclose [quit.main]"
print #main, "font ms_sans_serif 10"
'#main.hiddenOffScreenTxt "!setfocus"
'#main.log "!setfocus"
timer 1500, [readClip]
'goto [button1Click]
wait
[quit.main]
Close #main
END
[button1Click] 'Perform action for the button named 'button1'
update=1 'force adding to the log even if clipboard not changed
[readClip] 'entry point by timer
'get the data from hidden texteditor
oldString$= string$
print update, oldString$, string$
#main.hiddenOffScreenTxt "!cls"
#main.hiddenOffScreenTxt "!paste"
#main.hiddenOffScreenTxt "!contents? string$"
if (update=1) or (oldString$ <> string$ and string$<>"") then
'add it to the logs
#main.log time$(); " From clipboard ";len(string$);" bytes"
#main.log ">";string$;"<"
end if
update=0
wait