This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Konlab's profile picture

DialogBoxAPI

Started by Konlab, 16 April 2014 - 05:36 AM
Konlab #1
Posted 16 April 2014 - 07:36 AM
This api is used in Craftdroid (see link below the 'old post')
It creates dialog boxes, or pop-ups.
You can use this api for creating great UIs.
Please if you creates an app with this show me in credits or give a link to this page, thanks.
Old post:
SpoilerHi!
This API makes dialog boxes, it's simple and easy.(current version: 1.2)
You can create 3 types of dialog boxes:
-Error dialog box
-Yes or no dialog box
-Accept or cancel dialog box
Download:
Spoilerpastebin get 39hevtHr diaAPI
New functions:
SpoilerThis api has 4 functions:
errdialog(x,y,text)
X,Y->coordinates of dialog box
Text-> text in dialog box, it must be 15 or less characters long.
Buttons: OK -returns nil
yesorno(x,y,txt,title)
X,Y->coordinates
Title->title of dialog box
Text->text in dialog box
Both must be 15 or less characters long
Buttons:
Yes-returns true Note: not "true" but true-boolean value
No-returns false
acceptdia(x,y,txt,title)
x,y->coordianates
Title and txt->title and txt in dialogbox
Buttons: X-to close,returns false
Accept-returns true
cleardia(type,x,y)
type->1:error2:yesorno3:accept
Note: This function runs automatically when you click on OK/YES/NO/X/ACCEPT
To turn off this function open edit diaapi and at the 4. line you can see "config" and doesclear = true.
Change true to false to disable auto-clearing dialog boxes when clicking on a button.
Example code:
Spoiler
os.loadAPI("diaAPI")
diaAPI.errdialog(4,4,"test") --this creates an error dialog with text 'test'
Variable = diaAPI.yesorno(2,5,"title","text in box")
If variable == true then
Print("you clicked on yes!")
End
Coming soon:
SpoilerThis will be in diaapi 1.3
-Retry/ignore dialog boxes
-Manual dialog boxes
-Dialog Boxes will movable
For example:
Diaapi.manualdialog(beginx,endx,beginy,endy,type,title,txt,colorset)
-color sets(blue-white is yet, and green-yellow and red-white comes
Note: I found a bug in accept dialogs: the 'accept' button don't works (big bug), when I release the new version, there will this bug removed.
Thanks!

the version 1.2.1 is out only for CraftDroid users!
link: http://www.computerc...357-craftdroid/
Edited on 12 May 2014 - 11:18 AM
viluon #2
Posted 16 April 2014 - 02:30 PM
Nice idea! But I haven't tested yet, could you please fix the screenshots?
InDieTasten #3
Posted 18 April 2014 - 12:09 PM
pretty nice. haven't tested this but to get things faster at developing and focusing on the right things this is pretty helpful and has great usability.
keep up your great work. you could try and make a fully working GUI framework out of it. it's great practice and useful for future projects. you just have to stick with the perfect complexity for you. back in the day i was scaling my projects too big and never finished them.
Konlab #4
Posted 19 April 2014 - 05:41 PM
Nice idea! But I haven't tested yet, could you please fix the screenshots?

Fixed.

DiaAPI 1.3 is ALMOST done!
The retry dialog is working.
Manual dialog boxes will be not. :-(
But movable dialog boxes almost working!
Edited on 03 May 2014 - 04:40 PM
Konlab #5
Posted 12 May 2014 - 01:21 PM
Note: I'm creating the new versions only for CraftDroid, so if you download the diaAPI it's version 1.2
The newset versions are and descriptions for newest versions are only for Crafdroid!