Page 1 of 1

Making a Qbasic GUI

Posted: Thu Sep 08, 2005 8:28 pm
by Rocket Boy
Alright, I decided to start at the windowing system and mouse. Since that seems like a good start to any Qbasic GUI. The problem I'm having is, I need to figure out a way to define windows as such so that I can detect mouseclicks for them so I can move them around... and then set up some kind of a z-order so I can tell which Window is on top. The best way would be if I could so something along the lines of having a command like...

MakeWin (x1, y1, x2, y2, "titlebar")

Which would create a window with my coordinates and text in it's titlebar and set it as being the top of the z order. As of right now I have no idea how I'm actually going to implement this, and would really appreciate some suggestions. Maybe point me in the directions of some tutorials that might help me out. I'd like to do this without using libraries and other peoples code as much as possible.

Also, what's the best way to implement a simple graphical font routine that lets me put in coordinates easily?

Thanks!

Posted: Thu Sep 08, 2005 8:48 pm
by MystikShadows
Hi Rocket Boy,

Great project you setup for yourself. Looks like a good and interesting challenge...determining the Z-Order of windows is pretty much the easy part, atleast when you're creating your windows. last one created gets the Z-Order...much like windows :-).

Now if you have 10 windows created and overlapping each other, the Z-Order can only be determined by where the mouse is when you click to bring a window upfront. sure many windows might have ranges that bring it in the zone of where your mouse is...but only one (the most upfront window gets the focus. for that reason a variable to hold the window coordinates and the overlapping regions (with other windows) will help.

You can see examples without using the code. learning by example is often the best and quickest way to learn...atleast enough to get you started on your own :-).

http://www.jacobpalms.dk is a good place to start :-). and to ask GUI related questions...it's a site totally dedicated to GUI development in QB ;-). but hey you better keep us posted here too ;-). lol

Posted: Fri Sep 09, 2005 12:35 am
by Rocket Boy
Thanks for the tips, and I definately will keep you posted :)

Posted: Fri Sep 09, 2005 2:16 am
by SebMcClouth
Oh rocket boy, one question, plz do some good work on the code, I've seen several qb gui's and they lacked of good code. Mostly the authers didn't even know anymore what what was doing. So definatly add remarks and write what the code does.

grtz
Seb

Posted: Fri Sep 09, 2005 9:07 am
by The Walrus
If you need an easy to use font routine, try this:
www.jacobpalm.dk/downloads/EDITTXT.BAS

It has a textbox function too, but you can just remove that if you don't need it. The letters are 8x8 pixels and no background is drawed.

Hope this helps :D

Posted: Sat Sep 10, 2005 10:04 pm
by Zamaster
Id advise splitting it up: a routine that draws a window, a routine that creates a window, one that handles all the things about those windows

I would say that you should toss QB's standard colors and create a palette of your own. Also if you can, make it so windows ONLY GET UPDATED IF THEY HAVE TO! I see way too many programs these days that just keep redrawing or recalculating that take a toll on the CPU and make the program go much slower. Good luck!