Jump to content




Widget Api Full-Featured Gui

api utility

10 replies to this topic

#1 thomasbogue

  • Members
  • 6 posts

Posted 10 August 2013 - 05:34 PM

Announcing the widget API for easily creating beautiful GUI's with a variety of widgets.

Attached Image: widget_screenshot.png
Example of my mob spawner controller. Note the sliders, buttons and labels are nicely (and automatically) arranged. I apologize that the screen shot is too small. I uploaded a larger image, and I'm not sure how to make it larger on the forum. If anyone has advice, I'd be happy to hear it.

Documentation:
Attached File  widget_doc.pdf   60.74K   991 downloads

1 Features
• ease of use; few and simple commands to create and customize widgets
• automatic positioning of widgets means less work and better looking widgets; They also look good on different screen sizes
• myriad of widget types:
– buttons
– sliders
– toggles
– chooser (think drop-down combo box)
– labels
– progress bars
– and more
• object oriented framework makes adding new widgets easy; typically 10-15
minutes for me
• documentation and quick-start guide

2 Installation
Download widget from http://pastebin.com/PSmSpaLk . Place file in either rom/apis or your directly to your ComputerCraft computer.

Alternatively if you're running Minecraft v1.6 you can download and install the resource pack
Attached File  widget.zip   6.35K   213 downloads
At least I think so. I'm running 1.5 myself so I haven't been able to test resource packs.

Load with the command
os.loadAPI("widget")

3 Quick Start
Spoiler

4 Configuring the API
Spoiler

5 widget API for GUI designers
Spoiler

6 Possible future features
• a variable widget which can change between different widget types
• a tab widget which switches between multiple interface pages
• multimonitor support
• documentation for adding new widgets

7 example application: keypad
Spoiler

8 Licensing
Spoiler


#2 Bubba

    Use Code Tags!

  • Moderators
  • 1,142 posts
  • LocationRHIT

Posted 10 August 2013 - 05:41 PM

Very, very nice! Great documentation, standardization, and functionality. I'm generally not one to use other's APIs, but it looks like this one would be well worth using.

#3 thomasbogue

  • Members
  • 6 posts

Posted 10 August 2013 - 06:52 PM

Great! If you find a use for it, give me a screenshot. I'd love to see what use people get out of this thing.

#4 minizbot2012

  • Members
  • 122 posts
  • LocationPalm Bay, Florida

Posted 12 August 2013 - 03:08 PM

adding this to the rom/apis seems to cause computers in my world to not load, tested with the res pack. there is no errors in the terminal window.
Edit: after testing a bit more i find that i am able to manually load the widget api, but this is not what i want, i want it to autoload

#5 Encreedem

  • Members
  • 39 posts
  • LocationVirgo Supercluster

Posted 16 August 2013 - 10:42 AM

This looks great although I will probably not use it because I'm too lazy :lol: . I hope you don't mind if I steal some your ideas to make my API even better ^^

#6 Phoenix

  • Members
  • 3 posts

Posted 16 August 2013 - 12:10 PM

Questions Questions and a big thumb up for the Documentation.
One best GUI APIs I've seen.
Though I have some questions:
Q:
your example of the mob spawner controller.
How did you add text above the sliders?
Q:
So the Documentation...
It's pretty good.
But "5 widget API for GUI designers"
Always using "example" confuses the F*ck out of me.
But that might be just me.

5.1 widget
Constructor:
"example_widget=widget.newWidget()"

...

5.2 row
Constructor:
"example_row=widget.newRow()"

Isn't that better?
Or am I just being a Knuckle Head?

That's all.
EDIT:
Error I got while making a GUI

widget:357: vm error:
java.lang.negativeArraySizeException

GUI code:
os.loadAPI("widget")

AddX=widget.newSlider(5,15)
AddY=widget.newSlider(5,15)
Goh=widget.newButton("Goh!")
Test=widget.newButton("Example")
LabelX=widget.newLabel("Add X")
LabelY=widget.newLabel("Add Y")
--exampleSlider.value
--widgets, rows, colums, Lack of english
AddRow=widget.newRow()
AddRow:add(AddX)
AddRow:add(LabelX)--<<<This is causing the crash
AddRow:add(AddY)
AddRow:add(LabelY)--<<<This is causing the crash
AddRow:add(Goh)
ExampleRow=widget.newRow()
ExampleRow:add(Test)
main=widget.newColumn()
main:add(AddRow)
main:add(ExampleRow)
--edit functions
function Goh:onClick()
Goh:blink()
end
-- run GUI
main:run()

Also in the doc. >> "true iff the button is on"
One 'f' too much?

#7 Tonny

  • New Members
  • 1 posts

Posted 18 August 2013 - 05:59 AM

Hi Thomas,

I made some changes in your api, and implemented two new widgets ("switch" and "vertical slider"), both with includet label. If you are interested we can colaborated on this project for future:). Also if someone wants I can share edited api.


Posted Image

#8 InputUsername

  • Members
  • 231 posts
  • LocationThe Netherlands

Posted 19 August 2013 - 01:14 PM

Looks really useful. Great and extensive documentation. I also like the consistent and clean coding style of the API itself. Only I believe I have found a mistake in the code. Line 92 (in the function widget.run inside newWidget) says

if (widget==null) then

but 'null' is not Lua. I think it should be replaced with 'nil'.

Anyway, great job!

#9 Fenthis

  • Members
  • 13 posts

Posted 16 November 2013 - 02:20 PM

In the docs there is the following:

example=widget.newChooser(”axe”,”pick”,”axe”,”fish”)

It should be:


example=widget.newChooser(”axe”, { ”pick”,”axe”,”fish” })


#10 WorldObserver

  • New Members
  • 2 posts

Posted 20 February 2014 - 01:51 AM

Edit: Nvm i figured it out :P

Edited by WorldObserver, 20 February 2014 - 11:44 PM.


#11 CCGrimHaxor

  • Members
  • 140 posts

Posted 17 May 2014 - 02:39 PM

Due to my hard to understand simple things do you give me permission to use your api in my os?
Please replay fast the creation of the os is going to be finished soon.
What I will add:
I will give you full credit for the api
I will put a link to this post in my post
I will not edit the lisence
(You can add more if you wish)

Sorry if I wrote a word wrong I am using my phone and I am not that good in english





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users