Code Snippets / [DBC] Media-Less GUI Function Collection |
| Author | Message | ||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
This collection of functions for DB Classic (V1.2 but should work fine in V1.13) does not use a dll or external media so can be used with all versions of DBC. It includes: * Message Box - Display a simple message with OK button. * Alert Box - Confirmation with Yes/No buttons, with or without icon. * Input Box - Easily allow users to enter/edit text and numbers. * Colour Picker - Allows users to select a colour (inc RGB tool-tip). Usage: Place the "Alerts.dba" file in the same folder as your main DBA file and add the line: #Include "Alerts.dba" [Edit] Note: Updated (2nd) version now called GUI.dba instead of Alerts.dba. as the first line of your program. The demo program included in the attached zip (5K) shows how the functions are used. Reports on problems, additions etc. welcome. TDK_Man |
||
| Back to top |
|||
|
Sinani201
User Joined: Mon Apr 16th 2007 Location: tats a vry god cuestan lololol |
Cool! Seriously, how do you make the little blue text come up below your message? ![]() |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
Following a little update to my Fileselector function, it occurred to me that it should be part of this little set of GUI functions. So, it's now included and to avoid confusion with the first version, the #Include file is now called GUI.dba. New version of the demo program also included in the attached zip file (now 10K). And, as I forgot in the first post, here's a series of screen snapshots of what you get on the screen from each function: ![]() TDK_Man |
||
| Back to top |
|||
|
Jmahmood
User Joined: Tue Apr 3rd 2007 Location: not sure |
the color picker is just what i was looking for R.T.M. Thanks TDK |
||
| Back to top |
|||
|
Zombie 20
User Joined: Sun Nov 26th 2006 Location: Etters, PA |
Wow thank you very much TDK , very nice of you. ![]() Coffee coffee coffee coffee coffee coffee cappacino, JAVA! |
||
| Back to top |
|||
|
Kohaku
User ![]() Joined: Mon May 3rd 2004 Location: The not very United Kingdom |
Very nice! I only use DBP nowadays but you make the original DB look awesome; I almost miss it. ![]() You are not alone. |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
Version 1.3 Update: Now called GUI.dba, the #Include file now has a MemoBox function. ![]() It can display multiple lines of formatted text (non-editable) in a window, complete with scroll bar to view lines not visible and an OK button. Text is automatically word wrapped to fit the box. All you do is supply the width and height of the required text box - and of course the text itself, which can even be a text file! Zip file (12K) can be downloaded here. Includes updated demo program. TDK_Man |
||
| Back to top |
|||
|
Zotoaster
User ![]() Joined: Mon Dec 20th 2004 Location: Scotland |
This is really impressive. Nice work man Your signature has been erased by a mod |
||
| Back to top |
|||
|
Blood Of The Prophets
User Joined: Tue Nov 6th 2007 Location: Cyberspace |
Very impressive. I'm halfway through converting your code to the DarkGDK commands at the minute. But from what i can see in DBPro it would be very easy for me to add new controls like check boxes and radio buttons. |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
Quote: "in DBPro it would be very easy for me to add new controls like check boxes and radio buttons."
Yes, it's not difficult in DBC either - I have an incomplete GUI Component Designer in DBC that lets you add things like that to panels - similar to the way that Delphi works when you create a form. TDK_Man |
||
| Back to top |
|||
|
LBFN
User Joined: Sat Apr 7th 2007 Location: USA |
Very cool TDK! Nice work. LB |
||
| Back to top |
|||
|
OBese87
User Joined: Fri Jun 30th 2006 Location: On Toast |
Looking good TDK Glad to see you still working on this. Excuse me for asking what is probably an obvious question, but (assuming you will make forms with check boxes and radio buttons etc) how will the user's choice be returned? |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
First of all, to keep it simple, normal buttons and radio buttons won't be combined on the same form. For example, the ButtonBar lets you easily create a row, column or grid of buttons on a panel. When you click on one, the number of the button is returned. Whether it acts as a radio button or a normal button isn't relevant to anything other than how the button behaves on the screen. (Stays down while the previously selected one pops back up - or it pops back up automatically when you release the mouse button). The same goes for multiple choice radio selectors - you know the type where you have small circles in which a black dot appears in the middle when you select one. When you make your choice, the number of the one selected when you click on the OK button is returned from the function. Anyway... Version Release 1.4: Now including the ButtonBar function. Actually, there are two functions - one to create the ButtonBar: ButtonBar_Create(ButtonBarPosX,ButtonBarPosY,ButtonsAcross,ButtonsDown,32,32,"Keypad",101,201) ..and the other to poll it which is placed in your main program loop: ButtonPressed = ButtonBar_Poll(ButtonBarPosX,ButtonBarPosY,ButtonsAcross,ButtonsDown,32,32,Radio) See the demo program for more details. ![]() Download here. TDK_Man |
||
| Back to top |
|||
|
Robert The Robot
User ![]() Joined: Mon Jan 8th 2007 Location: Fireball XL5 |
Wow!! This is absolutely Fantastic! Thanks TDK!!! Did you hear about the two criminals who crashed their getaway car into a cement mixer? Police are looking for two hardened criminals... |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
The latest version now also has a TriInputBox function which allows you to enter three values at the same time. This is for situations like entering R, G and B values or X, Y and Z co-ordinates/angles but at the same time - rather than using the InputBox function three times. I've also decided to rewrite the functions using sprites as I've discovered they aren't too clever when used in a 3D environment. I'll post the new update in the next few days. TDK_Man |
||
| Back to top |
|||
|
Sasuke
User Joined: Fri Dec 2nd 2005 Location: Milton Keynes UK |
Great work as usual TDK, can't wait to see what you come up with next |
||
| Back to top |
|||
|
Google Ad
AdBot Joined: Aug 26th 2002 Location: Everywhere |
|||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
EDIT: I got this working and everything, however, if I use it to display alert messages in a game that uses 3d objects it doesn't show up however it suspends the program, any way around this? Or could it be that Im using DBPRO? |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
There's no way round the program stopping while you wait for the user to click on a component button in this version, but a quick fix for 3D is to use: Set Camera View 0,0,1,1 on the line before calling the function and Set Camera View 0,0,Screen Width(),Screen Height() on the line following the function call. This is one of the reasons I'm rewriting the functions. (Currently being tested with this: http://forum.thegamecreators.com/?m=forum_view&t=125358&b=10) TDK_Man |
||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
Edit: it doesn't seem to want to work |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
Probably yes. What is it doing (out of interest)? TDK_Man |
||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
it simply refuses to display anything... |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
Even if you do what I said a couple of posts above? TDK_Man |
||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
actually it appears to work now edit: I just noticed the colour picker zooms in extremely close when picking a colour. Is this supposed to happen? Also, this is just a nooby question |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
Quote: "the colour picker zooms in extremely close when picking a colour. Is this supposed to happen?"
Sorry - don't know what you mean with that one... Quote: "is it possible to change the colour of the GUI functions?"
Yes - just change the RGB lines. TDK_Man |
||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
Quote: "Quote: "the colour picker zooms in extremely close when picking a colour. Is this supposed to happen?"
Sorry - don't know what you mean with that one..." Ok, I'll post a screenshot when I get home. Quote: "Quote: "is it possible to change the colour of the GUI functions?"
Yes - just change the RGB lines." Oh! lol. Much simpler then I though . Thanks for the help, Data |
||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
o nvm! it seems to have worked now |
||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
Hi TDK, I've been using all these functions and I must say they're absolutely great! However, lately, when I attempted to use the file browser function for the first time (never needed that one until now) it comes up with an error message that says 'Array out of bounds'. Any idea what I could be doing wrong? Also, a perhaps less urgent question, is there any possible way to launch two of these functions at the same time? For instance, the memo box and a input box at the same time? Thanks Data |
||
| Back to top |
|||
|
TDK
Moderator ![]() Joined: Tue Nov 19th 2002 Location: Tenerife, Spain |
Without multitasking that would be a little difficult. Being functions, it's the nature of things in DB that once called they must complete and return a value (or not) before the next line of your program is executed. You would need to turn the functions into procedures which exit without doing anything and write a handler routine to call them if required once each time around the main loop. Sounds like a lot of work to me... As for the error, are you using DBC or Pro, as I seem to remember that problem cropping up for DBP users and it was fixed. Try this version: http://www.computechtenerife.com/zips/fileselectv2b.zip If it works OK, simply delete the fileselector function in the GUI collection Include file and #Include the new one you download. TDK_Man |
||
| Back to top |
|||
|
Data
User Joined: Fri Nov 26th 2004 Location: Winnipeg,Canada |
Thanks! |
||
| Back to top |
|||
|
Invincibob 8
User Joined: Mon Feb 4th 2008 Location: The Platefield Universe |
I keep getting a window that shows up like this. I did what the example and the actual functions file said, but it still happened. |
||
| Back to top |
|||
|
TheComet
User ![]() Joined: Thu Oct 18th 2007 Location: Conker rulz! |
|
||
| Back to top |
|||
|
TheComet
User ![]() Joined: Thu Oct 18th 2007 Location: Conker rulz! |
Sorry for double posting, but you have an error with the "TDK`s funky MemoBox": Runtime Error, cannot divide by zero! Your signature has been erased by a mod - Please reduce it to 600x120 maximum size |
||
| Back to top |
|||
Sorry, but it has been so long since anyone replied to this Thread that it has been automatically locked.
You may read it but not reply.
You may read it but not reply.
Forum Search
Enter a word or phrase to search our Forum for:
|
|


















