skewed text menus

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
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

skewed text menus

Post by sid6.7 »

skewing text menus

i am starting to make alittle text game havent actually done any code
yet but was wondering how do i keep the menu/screen from skewing
when text or numeric values change in size? is it the LOCATE command
the keeps everything straight? or TAB?


like below as en example of a simple menu...

Image
Last edited by sid6.7 on Sat Jul 22, 2006 2:01 am, edited 1 time in total.
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

IS this assuming you want the numbers right justified? and you don't want the right vertical line to cut off or offset? (pardon my french, I'm not 100% sure what skewing mean.

But one of the things I do is convert the number to a string with STR$ and add spaces based on the length of that string. (in FB you could use the FORMAT$ statement to format it properly).

Hence if I want a total width of 16 you could do something like:

ResultValue = SPACE$(16 - LEN(StringOfNumber)) + StringOfNumber

This would give something like:

Code: Select all

           12.32
          312.56
         1231.43
By doing it this way, you don't have to change your locate statement.

Hope this helps.
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
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 »

oops i guess i said it wrong
no not justification....or
i didnt quite understand your answer... :oops:


for example the first item

TEXT: here if it changed to TEXT: bubbasmith
the menu would shove everything to the right to
accomodate the extra new letters then the BARS
of my menu would skew(slide) off screen and wrap
around and all that...

same for the other
if NUMBERS: 1234 changed to 123456789 it would
shove the menu BARS all kitty wompas to the right
cuase the new data is longer then the old....

like this?

Image

or even worse it makes new blanks lines...
Antoni
Veteran
Posts: 132
Joined: Wed Jun 15, 2005 3:01 pm
Contact:

Post by Antoni »

Just write everything to a string then cut it to the right length with left$ before printing it to screen.
nkk_kan
Veteran
Posts: 57
Joined: Thu Jun 01, 2006 10:45 am
Location: Gujrat,India,Asia
Contact:

Post by nkk_kan »

well yeah Antoni's correct
i think you are using FreeBasic
But In Qbasic you could have used
ltrim() and Rtrim()
Do they work in freebasic?

and yes..
This is not skewing
if want to know what skewing means just
open paint
Image menu and there is an option called strecth/skew
open it and i am sure you would get the idea....
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

sid6.7 wrote:like this?

Image
From the looks of this, you're using a statement similar to

Code: Select all

PRINT string$+"|     |"
which will do that. There are a number of different solutions for this. But I think MystikShadows gave the easiest solution to it. Code? ;-)
Post Reply