Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Easy GUI

Author
Message
H4ck1d
19
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 16th Mar 2006 00:37 Edited at: 16th Mar 2006 00:42
Hi all!

I created this simple easy-to-use gui (graphical user interface) for those of us who are too poor or lazy to buy BlueGUI, and don't mind if it looks a little rough. It's very simple, and is definitely lacking in some places, but it is very functional and easy to use. I have included the .dba and documentation in the zip file. The gui is intended to be included using the #include command, and then accessed using the functions. Here's a little bit out of the document describing the interface:

--Setup Functions--
These functions are what you use to set up the GUI objects.

makeBtn(ButtonText$, xPos, yPos, Width, Height, Border)
- Makes a button, with the text in ButtonText$, with upper-left corner at xPos, yPos, and with the width and height specified. The border number is just a colored border around the button, just set it as 1 normally. Returns the number of the GUI object created.

makeChk(Text$, xpos, ypos, xsiz, ysiz, border, state)
- Makes a checkbox. The Text$ supplied is the text that will be printed to the left of the checkbox. The checkbox will be built at xpos, ypos, and will be xsiz and ysiz in size. The border specifies the thickness of the box, and if state is set at 1 then the checkbox will be checked. Returns the number of the GUI object created.

makeRbtn(Text$,xpos, ypos, xsiz, ysiz, border, state, group)
- Makes a radiobutton. The Text$ is the text which will be printed to the left of the radiobutton. The radiobbutton will be built at xpos, ypos, and will be xsiz and ysiz in size. The border specifies the thickness of the box, and if state is set at 1 then the radiobutton will be checked. The group specifies which group the radiobutton belongs to. In a single group, only one button can be selected at a time. Returns the number of the GUI object created.

makeTbox(Text$, xpos, ypos, xsiz, ysiz, border)
- Makes a text input box. The Text$ is text that will be in the textbox when it is created. To leave it empty, just put "" for Text$. The textbox will be built at xpos, ypos, and will be xsiz and ysiz in size. The border specifies the thickness of the box. Returns the number of the GUI object created.

--Interface Functions--
These are the main functions to interface with the GUI.

guiEvent()
- This is the main function that returns data to your program. In order for this function to work, you must call it as frequently as you want to get user input. If anything is clicked on, the function will return the id number of the GUI object clicked.

updateGui(noCls,noSync)
- This is the command that will draw the gui to your screen. If the first parameter is set to 1 then the program will not clear the screen when drawing. If the second parameter is set to 1 then the program will not sync after GUI is drawn to screen.

--Input Functions--
Use these functions to return data from the GUI.

returnSelection(groupNum)
- Will return the number of the radiobutton selected from the group specified

function returnState(objNum)
- This function returns the state (selected, unselected) of the object specified, either a checkbox or a radiobutton.

function clearGui()
- This function destroys all GUI objects


And a (very) small sample program:



Anyways, feel free to try it out and tell me what you think. Please, don't make fun of its looks, I didn't make it for beauty, more for functionality.

-H4ck1d

EDIT:

Just so you know, this seems to work a lot better and faster when exe is in windowed, non-fullscreen mode.

There are 10 types of people, those who understand binary and those that don't.

Attachments

Login to view attachments
H4ck1d
19
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 17th Mar 2006 02:19
I'm not sure I understand quite what you're saying . Are you saying the buttons only sense if the mouse is pressed down when it is over them, instead of a click and release?

There are 10 types of people, those who understand binary and those that don't.

Login to post a reply

Server time is: 2025-05-17 12:13:36
Your offset time is: 2025-05-17 12:13:36