Pasting from windows clipboard - right click
//----------------------------------------------------------------
//Edit box
iEditBoxID = CreateEditBox()
SetEditBoxPosition(iEditBoxID, 25, 25)
SetEditBoxSize(iEditBoxID, 100, 25)
SetEditBoxTextSize(iEditBoxID, 30)
//----------------------------------------------------------------
//Popup menu
global popupMenu
popupMenu = CreateSprite(0) //206,210,225
SetSpriteColor(popupMenu, 206, 210, 225, 255)
global popupMenuLabel
popupMenuLabel = CreateText('Paste')
SetTextSize(popupMenuLabel, 16)
SetTextColor(popupMenuLabel, 77, 83, 104, 255)
SetTextAlignment(popupMenuLabel, 1)
SetTextVisible(popupMenuLabel, 0)
SetSpriteSize(popupMenu, GetTextTotalWidth(popupMenuLabel)+20, GetTextTotalHeight(popupMenuLabel)+10)
SetSpriteDepth(popupMenu, GetEditBoxDepth(iEditBoxID)-1)
SetTextDepth(popupMenuLabel, GetSpriteDepth(popupMenu))
SetSpriteVisible(popupMenu, 0)
//----------------------------------------------------------------
do
EditBoxPaste(iEditBoxID)
Sync()
loop
function EditBoxPaste(iEditBoxIndex as integer)
if GetRawMouseRightPressed() = 1 and GetEditBoxHitTest(iEditBoxIndex, GetPointerX(), GetPointerY() ) = 1
SetSpritePosition(popupMenu, GetPointerX(), GetPointerY() )
SetTextPosition(popupMenuLabel, GetPointerX()+GetSpriteWidth(popupMenu)/2, GetPointerY()+GetSpriteHeight(popupMenu)/2-GetTextTotalHeight(popupMenuLabel)/2 )
SetSpriteVisible(popupMenu, 1)
SetTextVisible(popupMenuLabel, 1)
endif
if GetSpriteVisible(popupMenu) = 1
//----------------------------------------------------------------
//hover
if GetTextHitTest(popupMenuLabel, GetPointerX(), GetPointerY()) = 1
//on
SetTextColor(popupMenuLabel, 0, 0, 0, 255)
else
//off
SetTextColor(popupMenuLabel, 77, 83, 104, 255)
endif
//----------------------------------------------------------------
//paste
if GetPointerPressed() = 1
if GetSpriteHitTest(popupMenu, GetPointerX(), GetPointerY()) = 1 and GetTextHitTest(popupMenuLabel, GetPointerX(), GetPointerY()) = 1
SetEditBoxFocus (iEditBoxIndex, 1)
SetSpriteVisible(popupMenu, 0)
SetTextVisible(popupMenuLabel, 0)
SetEditBoxText(iEditBoxIndex, GetClipboardText() ) // >> GetClipboardText() <<
else
SetSpriteVisible(popupMenu, 0)
SetTextVisible(popupMenuLabel, 0)
endif
endif
//----------------------------------------------------------------
endif
endfunction
function GetEditBoxHitTest( iEditBoxIndex as integer, x as float, y as float )
eX# = GetEditBoxX(iEditBoxIndex)
eY# = GetEditBoxY(iEditBoxIndex)
eW# = GetEditBoxWidth(iEditBoxIndex)
eH# = GetEditBoxHeight(iEditBoxIndex)
if x > eX# and x < eX#+eW# and y > eY# and y < eY#+eH#
result = 1
else
result = 0
endif
endfunction result
Or press "Ctrl+V"
iEditBoxID = CreateEditBox()
SetEditBoxPosition(iEditBoxID, 25, 25)
SetEditBoxSize(iEditBoxID, 100, 25)
SetEditBoxTextSize(iEditBoxID, 30)
do
EditBoxPaste(iEditBoxID)
Sync()
loop
function EditBoxPaste(iEditBoxIndex as integer)
//Ctrl+V
if GetRawKeyState(17) = 1 and GetRawKeyPressed(86) = 1
if GetEditBoxHasFocus(iEditBoxIndex) = 1
SetEditBoxText(iEditBoxIndex, GetClipboardText() )
endif
endif
endfunction
https://www.instagram.com/qugurun/