Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:38 pm
by cnwjhp1 >> Mon, 30 Aug 2004 4:33:46 GMT
This works - add an Integer attribute called mouseState to the form, then put this code in the TextBox you are copying from (tCmdLine in my example):
tCmdLine_mouseDown(textbox:TextBox input; button:Integer; shift:Integer; x:Real; y:Real) updating;begin
mouseState:=button;
end;
tCmdLine_mouseUp(textbox:TextBox input; button:Integer; shift:Integer; x:Real; y:Real) updating;begin
mouseState:=0;
end;
tCmdLine_keyPress(textbox:TextBox input; keyCharCode:Integer io) updating;begin
if keyCharCode.Character="s" and mouseState>0 then
write textbox.selText;
endif;
end;
Then, if you select text with the left mouse button and press s before letting the mouse button up, the selected text will be displayed. You will need a reference to the other form or textbox to copy it there.
Depending on what you are trying to accomplish though, I would have thought that assigning Ctrl codes would be nicer (for the developer and the user). For example, capture Ctrl+S in keyDown and do the copy that way:
tCmdLine_keyDown(textbox:TextBox input; keyCode:Integer io; shift:Integer) updating;begin
if keyCode=83 and shift=2 then
write textbox.selText;
endif;
end;
Cheers,
John P