Post by tsh73 on Aug 4, 2022 9:51:01 GMT
It looks like in JB2 "!paste" sometimes go to wrong texteditor
actually in active one
Same program works OK in JB 1.01
Same (wrong) behaviour happens in LB 4.5.1
Workaround:
you can manually setfocus before paste and return focus back.
Problem is, you have no way of knowing where "back" (active control) is in JB - in LB it could be got by API call
Instructions:
put the program in JB
copy to clipboard single word (or it likely will have all program code!)
run program
After timer fires, clipboard text should appear in lower textbox
Now click in that textbox
PASTE that should work on upper textbox
(there is only one PASTE command,
somehow adds text to lower one
actually in active one
Same program works OK in JB 1.01
Same (wrong) behaviour happens in LB 4.5.1
Workaround:
you can manually setfocus before paste and return focus back.
Problem is, you have no way of knowing where "back" (active control) is in JB - in LB it could be got by API call
Instructions:
put the program in JB
copy to clipboard single word (or it likely will have all program code!)
run program
After timer fires, clipboard text should appear in lower textbox
Now click in that textbox
PASTE that should work on upper textbox
(there is only one PASTE command,
#main.hiddenOffScreenTxt "!paste"
)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