Page 1 of 1

skewed text menus

Posted: Fri Jul 21, 2006 9:57 pm
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

Posted: Fri Jul 21, 2006 10:11 pm
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.

Posted: Sat Jul 22, 2006 2:00 am
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...

Posted: Sat Jul 22, 2006 1:57 pm
by Antoni
Just write everything to a string then cut it to the right length with left$ before printing it to screen.

Posted: Tue Jul 25, 2006 4:36 am
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....

Posted: Tue Jul 25, 2006 6:34 pm
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? ;-)