Posted 31 August 2015 - 06:09 PM
I want to make a movable window using window.create (or something else) with an app running in it. Actually I have a code, that allows me to move pseudo-window, I will put the code down here. Is it possible ?
If you have an api, that allows me to do it, give me a link please :D/>
Code for moving, that is 'modified version' of laby os
Please, don't look @ my grammar, because i'm russian
If you have an api, that allows me to do it, give me a link please :D/>
Code for moving, that is 'modified version' of laby os
Spoiler
-- ############################################################
plany = true
term.setCursorBlink(false)
os.loadAPI("windows")
function drag()
while true do
event, button, X, Y, xSize, ySize = os.pullEvent("mouse_drag") -- ### mouse drag function
XY = X..","..Y
-- ############################################################
if button == 1 then -- window design
windows.clearScreen(colors.lightBlue)
windows.square(X-8,Y,17,1,colors.lightGray)
windows.colorTextWithBack(X-8,Y,"X",colors.white,colors.red)
windows.square(X-8,Y+1,17,4,colors.white)
end
end
end
-- ############################################################
function click()
while true do
event, button, X, Y = os.pullEvent("mouse_drag") -- ### mouse drag function
XY = X..","..Y
event, button, X2, Y2 = os.pullEvent("mouse_click") -- click (close) function
XY2 = X2..","..Y2
if XY2 == (X - 8) .. "," .. Y and button == 1 then -- #### Close position
plany = false
os.reboot()
end
end
end
-- ###########################Start#################################
term.setBackgroundColor(colors.lightBlue)
shell.run("clear")
parallel.waitForAny(drag, click)
Please, don't look @ my grammar, because i'm russian
Edited on 31 August 2015 - 04:36 PM