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

DiaAPI-dialog boxes, simple

Started by Konlab, 30 March 2014 - 06:23 PM
Konlab #1
Posted 30 March 2014 - 08:23 PM
Hi!
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
Pictures:
Spoiler[attachment=1551:diaapi-yesornojpg.JPG]
[attachment=1552:diaapi-errdialogjpg.JPG]

Sorry, I can't upload larger files :mellow:/>
Coming soon:
SpoilerThis will be in diaapi 1.3
-Retry/ignore dialog boxes
-Manual dialog boxes
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, when I release the new version, in new version will this bug removed.
Thanks!

The desscription of older version:
SpoilerHello!
This is my first API, I think it is a little bit useful, it can create dialog boxes with buttons.
Download: run
pastebin get 4xy0FmCi
It consists of 3 functions:
errdialog(x,y,text)
X,Y->coordinates of dialog box
Text-> text in dialog box, it must be 15 or less characters long.
yesorno(x,y,txt,title)
Returns:
Boolean(true -> clicked on yes)
X,Y->coordinates
Title->title of dialog box
Text->text in dialog box
Both must be 15 or less characters long
The third function is
cleardialog(x,y,type)
X,y->coordinates
Type->1-errordialog2-yesornodialog3-accept/canceldialog

Note:cleardialog runs automatically, to turn off this function open with editor diaAPI and at the 4th line you can see a boolean variable named doesclear:
doesclear = true
And set the value to false, and done
Edited on 09 April 2014 - 06:42 PM
apemanzilla #2
Posted 31 March 2014 - 01:52 PM
Please use code tags, spoilers, and BBCode in general D:

Also, the saying is no pics, no clicks…
Konlab #3
Posted 31 March 2014 - 03:52 PM
Ok, pics comes later, I'm creating an another program, and I have not got yet free time.
Konlab
Pretty gorilla :)/> ;)/>
apemanzilla #4
Posted 31 March 2014 - 08:06 PM
Ok, pics comes later, I'm creating an another program, and I have not got yet free time.
Konlab
Pretty gorilla :)/> ;)/>
Yeah, gorillas are all pretty and stuff until you piss one off :P/>
Engineer #5
Posted 31 March 2014 - 10:11 PM
Also, the saying is no pics, no clicks…

That is really something that is not true. I mean, its about the code after all!!!
apemanzilla #6
Posted 01 April 2014 - 12:40 PM
Also, the saying is no pics, no clicks…

That is really something that is not true. I mean, its about the code after all!!!

True, but for something like an API that adds GUIs, often I'm only browsing the forums on my phone where I can't download and test the code. (Yet!)
Konlab #7
Posted 01 April 2014 - 03:27 PM
sorry, i found an error:
not diaapi.yesorno(x,y,title,txt)
but:
diaapi.yesorno(x,y,txt,title)
sorry :(/>
Konlab #8
Posted 01 April 2014 - 03:42 PM
And here is your picture apemanzilla ;)/>
Happy programming with this API ;)/>
apemanzilla #9
Posted 01 April 2014 - 05:19 PM
Might try this later when I'm not in school ;)/>
Konlab #10
Posted 02 April 2014 - 07:20 AM
Ok, I try this. Yet I'm not in school.
Where do you live?(time zones)
I'm in time zone +1(central europan time)