Making a Qbasic GUI

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Rocket Boy
Coder
Posts: 19
Joined: Thu Sep 08, 2005 3:14 am

Making a Qbasic GUI

Post 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!
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post 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
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
Rocket Boy
Coder
Posts: 19
Joined: Thu Sep 08, 2005 3:14 am

Post by Rocket Boy »

Thanks for the tips, and I definately will keep you posted :)
User avatar
SebMcClouth
Veteran
Posts: 240
Joined: Fri Apr 29, 2005 2:20 am
Location: Inside the Matrix

Post 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
I know why you're here. I know what you've been doing... why you hardly sleep, why you live alone, and why night after night, you sit by your computer...<br>
Unfortunately, no one can be told what Qbinux is. You have to see it for yourself.
User avatar
The Walrus
Veteran
Posts: 87
Joined: Fri Apr 01, 2005 7:19 am
Location: Denmark
Contact:

Post 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
If swimming is so good for your figure, how do you explain walruses?
User avatar
Zamaster
Veteran
Posts: 174
Joined: Wed Jun 15, 2005 1:51 pm

Post 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!
C:\DOS
C:\DOS\RUN
RUN\DOS\RUN
Post Reply