←  APIs and Utilities

ComputerCraft | Programmable Computers for Minecraft

»

Multitasking Window API

Jummit's Photo Jummit 12 Apr 2018

This is kind of the advanced version of ShellSplit, my first program that uses coroutines to achieve multitasking. This one is way more complex, featuring movable, resizable windows.
Demo at work:
Posted Image
Download:
API: pastebin get UQM4T3J3 programs.lua
DEMO: pastebin get HiqdSExG demo.lua
To try it out, just download the api and run the demo
Edited by Jummit, 12 April 2018 - 07:19 PM.
Quote

CCTech's Photo CCTech 14 Apr 2018

nice work ;) looks pretty cool.

Would it be ok if I use this in my OS? I surely will credit you
Quote

Jummit's Photo Jummit 14 Apr 2018

 OneTech, on 14 April 2018 - 06:18 PM, said:

nice work ;) looks pretty cool.

Would it be ok if I use this in my OS? I surely will credit you
I actually made this with my coming OS in mind. Sure, give it a go!
<greedy me>
It only costs one upvote!
</greedy me>
Edited by Jummit, 14 April 2018 - 06:46 PM.
Quote

CCTech's Photo CCTech 14 Apr 2018

 Jummit, on 14 April 2018 - 06:45 PM, said:

<greedy me>
It only costs one upvote!
</greedy me>

Upvote? Sorry i‘m not so often here..
Quote

Lupus590's Photo Lupus590 14 Apr 2018

 OneTech, on 14 April 2018 - 09:33 PM, said:

Upvote? Sorry i‘m not so often here..

the little green arrow in the bottom right of posts (your posts won't have one as you cannot upvote your own post).
Quote

CCTech's Photo CCTech 14 Apr 2018

 Lupus590, on 14 April 2018 - 09:44 PM, said:


the little green arrow in the bottom right of posts (your posts won't have one as you cannot upvote your own post).

Thanks didn‘t saw it.. it‘s because I‘m using this on phone.. (can‘t access my laptop right now)
Quote

Jummit's Photo Jummit 16 Apr 2018

A new version is out, now will display on top when selected. The api has not changed, so you can use the code you have made before the change.
Quote

minebuild02's Photo minebuild02 20 Jun 2018

I would like to try and use it in my new OS that is currently in development.
Quote

InFluXx's Photo InFluXx 27 Mar 2019

May I use this API on the OS I'm working on? I credit you
Quote

CCTech's Photo CCTech 02 Apr 2019

Well uhm.. I'm not really sure that this is the right place but asking in "Ask a pro" would be not the best choice (I think?)

I tried to add this windows system to my OS and now I stuck at making a window handler.

It kinda works. It draws the windows but... they're black

Here are the codes:

inside the handler
function drawWindows()
  while true do
    local event, var1, var2, var3 = os.pullEventRaw()
    if event == "terminate" then end
    windows.update(kernel.programs, event, var1, var2, var3)
  end
end

And then if a new window is created:
function taskBar()
  windows.new(function()
    shell.run("/PowerOS/sys/taskBar)")
  end, 9, 1, 35, 2)
end
function drawDesktop()
  opscy.drawColor(colors.white)
  table.insert(kernel.programs, taskBar())
end

The window that should appear is black without the topbar (Even if the positions aren't 1,1)

I tried it with some other programs which should run inside the window but with no success...

I have often rewrote the full code

I hope you can help me :P
Quote

Jummit's Photo Jummit 03 Apr 2019

 CCTech, on 02 April 2019 - 02:05 PM, said:

I tried to add this windows system to my OS and now I stuck at making a window handler.

- snip -

I need more of your code to help you. What does windows.update and windows.new do?
Quote

CCTech's Photo CCTech 03 Apr 2019

 Jummit, on 03 April 2019 - 05:05 PM, said:

I need more of your code to help you. What does windows.update and windows.new do?

Uhh.. it's from your window API i just did

local windows = require(TheApiPath)

instead of

local program = require(TheApiPath)

It was all of my code that I posted which is for handling the Windows
Quote

Jummit's Photo Jummit 03 Apr 2019

 CCTech, on 03 April 2019 - 07:38 PM, said:

 Jummit, on 03 April 2019 - 05:05 PM, said:

I need more of your code to help you. What does windows.update and windows.new do?

Uhh.. it's from your window API i just did

local windows = require(TheApiPath)

instead of

local program = require(TheApiPath)

It was all of my code that I posted which is for handling the Windows
Oops, I didn't spot that. I havn't worked with this api for quite some time, so I didn't notice.
Your issue is that the taskBar function never returns anything. Here is the fixed code:
function taskBar()
  return windows.new(function()
    shell.run("/PowerOS/sys/taskBar)")
  end, 9, 1, 35, 2)
end
Quote

CCTech's Photo CCTech 04 Apr 2019

 Jummit, on 03 April 2019 - 07:49 PM, said:

 CCTech, on 03 April 2019 - 07:38 PM, said:

 Jummit, on 03 April 2019 - 05:05 PM, said:

I need more of your code to help you. What does windows.update and windows.new do?
Uhh.. it's from your window API i just did
 local windows = require(TheApiPath) 
instead of
 local program = require(TheApiPath) 
It was all of my code that I posted which is for handling the Windows
Oops, I didn't spot that. I havn't worked with this api for quite some time, so I didn't notice. Your issue is that the taskBar function never returns anything. Here is the fixed code:
 function taskBar() return windows.new(function() shell.run("/PowerOS/sys/taskBar)") end, 9, 1, 35, 2) end 

Oh, indeed! Thanks for the quick support! Didn't thought about that it may needs to return something :P
Quote

CCTech's Photo CCTech 05 Apr 2019

aaand... sorry if I disturb you

I just think that I'm too... well I think you know what I mean..

Is there a way to reparent a window? I have a program that starts other programs but their windows only appear inside the programs window and not as seperate windows.

I also tried making a table and the update function inside the window handler (not your API) checks if it is empty. If not then it should move the window from inside the table inside the right table that contains all windows. Still only inside the window that runs it... So is there any way of "parenting" a window?

Thanks in advance

and: Am I allowed to modify the API a bit to change the window designs? I want to be on the safe side :P
Quote

CCTech's Photo CCTech 05 Apr 2019

Never mind.. got it to Work :P
Quote