UE4 複製文字到剪下板 從剪下板貼上文字

2021-08-15 03:46:34 字數 1527 閱讀 8666

ue4初學筆記:

ue4 複製文字到剪下板/從剪下板貼上文字(ctrl+c/ctrl+v),**中有已經封裝好的方法:

fplatformmisc::clipboardcopy(const tchar* str);

fplatformmisc::clipboardpaste(class fstring& dest);

但是沒有找到怎麼直接在藍圖中使用,所以只好自己拿來封裝一下。

在編輯器中新建c++方法藍圖

稍微改下名字叫 mytextblueprintfunctionlibrary

在.h檔案中新增2個方法

.cpp中實現

儲存,回到編輯器編譯(compile)專案 

完成之後就可以在藍圖中使用自己寫的函式啦。

測試一下:新建乙個widget控制項,新增2個文字框 2個按鈕用作ctrl+c  ctrl+v,並為按鈕新增事件,把其中乙個文字框內容複製到另乙個裡面,來測試ctrl+c/v有沒有成功

建立關卡,在關卡藍圖中建立測試藍圖

ok,執行測試

剪下板操作 複製,剪下

copyfile.h pragma once include include include include include include using namespace std class ccopyfilesoper copyfile.cpp include stdafx.h include ...

複製到剪下板 clipboard

function copyhandle content document.addeventlistener copy copy document.execcommand copy 過程 1.document.execcommand copy 觸發複製監聽事件 2.e.clipboarddata.se...

點選複製到剪下板

doctype html html lang en head meta charset utf 8 meta name viewport content maximum scale 1.0,minimum scale 1.0,user scalable 0,initial scale 1.0,wid...