Jump to content




txUI - Elegant GUI Components With Built-in Window Management


  • You cannot reply to this topic
16 replies to this topic

#1 tuogex

  • Members
  • 13 posts

Posted 09 July 2014 - 12:23 AM

txUI

txUI is a ComputerCraft library designed to make rendering user interfaces easy yet powerful. It does this with object oriented components.
Any time you want to draw a component in txUI, all you have to do is add the component to a parent; be that a list or a window. You only need to change the fields that you want to. Want to make a blue button? You can! Want to make a button that changes color every time you click it? You can! Don't want a scroll bar in your list? Change one field and it's gone!

As of v1.0.0, txUI also serves a window manager.

Please post suggestions for features; you can track the progress, submit bugs, and suggest features on the project's GitHub repository.

Supported UI Components

UI components will only be drawn once it is added to a window.

Button
Label
TextField
List
Checkbox
ProgressBar

Posted Image
An example showing just some of the supported UI components. Code for this example available here.

Demo
Spoiler


Get txUI

Current version on Pastebin: tuzXZBiz
pastebin run tuzXZBiz
The script will create a file called txUI in the current directory.
GitHub: tuogex/txUI wiki
Note that files from the GitHub repository have the .lua extension.

Documentation

Find guides and tutorials here.
Find detailed function and parameter documentation on the GitHub wiki.

Releases

GitHub releases page

Spoiler

Edited by tuogex, 21 October 2015 - 09:26 PM.


#2 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 11 July 2014 - 07:12 AM

I like it. It looks much more snazzy than most GUI APIs I've seen. I love the fact that you're using an OOP approach to this, particularly the event driven system. Looking forward to experimenting with it. Personally I wouldn't bother with a window, it just adds one more layer of code with normally little added functionality. But overall, this is some pretty nice code.

#3 tuogex

  • Members
  • 13 posts

Posted 11 July 2014 - 08:47 PM

View PostSquidDev, on 11 July 2014 - 07:12 AM, said:

I like it. It looks much more snazzy than most GUI APIs I've seen. I love the fact that you're using an OOP approach to this, particularly the event driven system. Looking forward to experimenting with it. Personally I wouldn't bother with a window, it just adds one more layer of code with normally little added functionality. But overall, this is some pretty nice code.
Thanks for the response. Initially this library was meant for a desktop environment where the window object would actually have a use. The DE never came to be, but I'm currently working on making the window act almost like an Android Activity to actually give it some use. I have regained some interest in this project and plan on adding some features as well as maintaining it.

#4 nickname912

  • Members
  • 13 posts

Posted 13 July 2014 - 08:40 AM

Awesome api. I hope you continue develop it to something even more awesome.

#5 tuogex

  • Members
  • 13 posts

Posted 14 July 2014 - 05:16 PM

View Postnickname912, on 13 July 2014 - 08:40 AM, said:

Awesome api. I hope you continue develop it to something even more awesome.
Thanks! You can follow my development progress on GitHub.

#6 LDShadowLord

  • Members
  • 115 posts

Posted 16 July 2014 - 10:20 PM

So, as something I think you should add. Maybe the ability to "inherit" traits from other objects of the same type. Then I can make default sets of windows or labels, etc. And immediately call them without needing to re-code them.

#7 bigbrainiac10

  • Members
  • 41 posts

Posted 19 July 2014 - 03:45 PM

Hey, I'm currently using this API in a project of mine, which is great!

However, is there any way of forcing an update every few seconds or so, rather than each time an event happens (a click)

I need this because I want a label to be updated with the correct information gained via a peripheral (energy cell - openp)

#8 Mr. Bateman

  • Members
  • 98 posts
  • LocationAustralia

Posted 19 July 2014 - 04:09 PM

View Postbigbrainiac10, on 19 July 2014 - 03:45 PM, said:

Hey, I'm currently using this API in a project of mine, which is great!

However, is there any way of forcing an update every few seconds or so, rather than each time an event happens (a click)

I need this because I want a label to be updated with the correct information gained via a peripheral (energy cell - openp)
Try os.startTimer( nSeconds )
After nSeconds, it creates an event "timer" and txUI should pick it up

#9 bigbrainiac10

  • Members
  • 41 posts

Posted 19 July 2014 - 05:28 PM

View PostROFLCopter64bit, on 19 July 2014 - 04:09 PM, said:

View Postbigbrainiac10, on 19 July 2014 - 03:45 PM, said:

Hey, I'm currently using this API in a project of mine, which is great!

However, is there any way of forcing an update every few seconds or so, rather than each time an event happens (a click)

I need this because I want a label to be updated with the correct information gained via a peripheral (energy cell - openp)
Try os.startTimer( nSeconds )
After nSeconds, it creates an event "timer" and txUI should pick it up

I was thinking that myself not long after I posted this.

I'm going to try it now.

#10 bigbrainiac10

  • Members
  • 41 posts

Posted 19 July 2014 - 05:42 PM

Nevermind, I'm not sure how to implement it, I'm trying:
txUI.UIManager.appUpdate = function(self)
powerAvailable.text = tostring(cell.getEnergyStored(cellDirection))
end
but that prevents me from typing into the TextField components...

Any Ideas?

EDIT: Actually, I think that may be a bug tuogex, if you have something constantly updating a value in appUpdate, it will become impossible for you to enter into TextField components but still possible to click buttons and things.

Edited by bigbrainiac10, 19 July 2014 - 09:51 PM.


#11 tuogex

  • Members
  • 13 posts

Posted 21 July 2014 - 02:47 PM

View Postbigbrainiac10, on 19 July 2014 - 05:42 PM, said:

Nevermind, I'm not sure how to implement it, I'm trying:
txUI.UIManager.appUpdate = function(self)
powerAvailable.text = tostring(cell.getEnergyStored(cellDirection))
end
but that prevents me from typing into the TextField components...

Any Ideas?

EDIT: Actually, I think that may be a bug tuogex, if you have something constantly updating a value in appUpdate, it will become impossible for you to enter into TextField components but still possible to click buttons and things.
I'll be looking in to this when I get back from California, thanks.

Edit: In the most recent release, the timer event is no longer handled (but is consumed). I tested this by queuing a 'txui_forceupdate' event every second, but was unable to reproduce the problem.

Edited by tuogex, 25 May 2015 - 04:55 AM.


#12 achjaj

  • New Members
  • 1 posts

Posted 10 October 2015 - 02:29 PM

Hi, how can I change Label text?

P.S. Your API is fantastic!

#13 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 10 October 2015 - 06:40 PM

View Postachjaj, on 10 October 2015 - 02:29 PM, said:

Hi, how can I change Label text?

P.S. Your API is fantastic!

I would suggest to move to another GUI framework (like this one) because 1. this API is extremely old and not updated for a long time and 2. the creator of this API was last online some months ago = no support for the API.

#14 tuogex

  • Members
  • 13 posts

Posted 21 October 2015 - 06:48 PM

View Postachjaj, on 10 October 2015 - 02:29 PM, said:

Hi, how can I change Label text?

P.S. Your API is fantastic!

Thanks a bunch! You can change the text of a Label by passing a a table with a value with the key 'text'.
txUI.Label:new({text = "Hello World!";})

View PostH4X0RZ, on 10 October 2015 - 06:40 PM, said:

View Postachjaj, on 10 October 2015 - 02:29 PM, said:

Hi, how can I change Label text?

P.S. Your API is fantastic!

I would suggest to move to another GUI framework (like this one) because 1. this API is extremely old and not updated for a long time and 2. the creator of this API was last online some months ago = no support for the API.
It's been a while since I've updated this thread but I made some commits to the GitHub repo over the summer to add window management capabilities into txUI along with performance improvements and other features. I'll try to support the API as much as I feasibly can, but you're right; I'm not on these forums much.

#15 dodecaflexagon

  • Members
  • 5 posts

Posted 24 December 2017 - 01:19 AM

I like this API, especially the windows. Is it possible to change the size of the windows?
Never mind, shifting to a different API and some custom hard-code UI.

Edited by dodecaflexagon, 24 December 2017 - 01:45 AM.


#16 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 24 December 2017 - 01:45 AM

Given that the author hasn't logged in here for a couple of years, it's highly unlikely any additional features will be added.

#17 LMongoose

  • New Members
  • 2 posts

Posted 31 December 2017 - 11:09 PM

hi, i am getting some errors when opening your example codes
window:94: Arguments must be the same length,...

Edit 1: solved :)

Edited by LMongoose, 01 January 2018 - 03:39 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users