[Sloved] Change Listbox list size

Post

Posted
Rating:
#1 (In Topic #695)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hi Everyone,

Can someone show me please how I can display 2 line to in a List box?

I can do the Chr(10) & chr(13) but when it is added to the list some of the top and bottom of the text is missing (it looks like the list section has not expanded enough to allow the 2 lines see example)

<IMG src="https://www.algpos.co.uk/webimage/2lineexample.png"> </IMG>
Online now: No Back to the top

Post

Posted
Rating:
#2
Regular
vuott is in the usergroup ‘Regular’
I suggest this page from italian wiki:

   ListBox con due o più righe per item - Gambas-it.org - Wikipedia

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#3
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 Thanks vuott I shall try that in the morning.
Online now: No Back to the top

Post

Posted
Rating:
#4
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hi Everyone,

Thank-you to everyone who has given me advice on this issues

<IMG src="https://www.algpos.co.uk/webimage/2lineexample-1.png"> </IMG>

As you can see it works perfectly now

All I need to do is work out how to have spaces working

example

Dataline 1______________________________Message
Dataline 2
Dataline 3 This is longer __________________Message

the __ is the number of spaces needed to align the Message section
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’

Code (gambas)

  1.    
  2. sitem#1 = "Amount"    
  3. sitem#2 = "102.65"
  4.  sItem#1 & Space(30 - Len(sItem#1)) &  sItem#2"]
Online now: No Back to the top

Post

Posted
Rating:
#6
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

grayghost4 said

Code (gambas)

  1.    
  2. sitem#1 = "Amount"    
  3. sitem#2 = "102.65"
  4.  sItem#1 & Space(30 - Len(sItem#1)) &  sItem#2"]

Thanks grayghost4 do I need to change the font to a mono spaced one for that to work?
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
You can also use :

Code (gambas)

  1. String.PadRight(sItem#1, 30, " ") &  sItem#2"

Returns a new string that left-aligns the characters in the original string by padding them on the right with a specified string pattern, for a specified total length.
<LIST>
  • <LI>String is the string to pad.
    Length is the final length in UTF-8 characters.
    Pad is the string pattern used for padding. By default, a space is used.</LI>
</LIST>

See also: String.PadLeft

Cheers - Quin.
I code therefore I am
Online now: No Back to the top

Post

Posted
Rating:
#8
Regular
vuott is in the usergroup ‘Regular’
… and if you like the thrill of external functions:  :D

Code (gambas)

  1. ' int printf (const char *__restrict __format, ...)
  2. ' Write formatted output to stdout.
  3. Private Extern printf(__format As String, arg1 As String, arg2 As String) As Integer In "libc:6"
  4.  
  5.  
  6. Public Sub Main()
  7.  
  8.   printf("%-30s%1s\n", "Dataline 1", "Message...")
  9.   printf("%-30s%1s\n", "Dataline 2", "Message...")
  10.   printf("%-30s%1s", "Dataline 3 This is longer", "Message...")
  11.  

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#9
Guru
BruceSteers is in the usergroup ‘Guru’

AndyGable said

grayghost4 said

Code (gambas)

  1.    
  2. sitem#1 = "Amount"    
  3. sitem#2 = "102.65"
  4.  sItem#1 & Space(30 - Len(sItem#1)) &  sItem#2"]

Thanks grayghost4 do I need to change the font to a mono spaced one for that to work?

do you know how quick it would be to try it for yourself and see?

;)
Online now: No Back to the top

Post

Posted
Rating:
#10
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
do you know how quick it would be to try it for yourself and see?

I had a long post typed up in response to his post….. about strings or numbers and weather the numbers had decimals in them and weather the strings had multiple lines and weather posting to the screen or a printer that used postscript or a simple POS printer and several other things that I can't remember now …

and it ended with   "Trial and Error"

and then I deleted it …. anyone posting here should have enough experience with programing that I don't need to tell them any of that  :lol:

PS. and I may return and delete this post also  :D
Online now: No Back to the top

Post

Posted
Rating:
#11
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

grayghost4 said

Code (gambas)

  1.    
  2. sitem#1 = "Amount"    
  3. sitem#2 = "102.65"
  4.  sItem#1 & Space(30 - Len(sItem#1)) &  sItem#2"]

This one works perfectly once I changed the font to Courier 10 Pitch (as that is a monospaced font)

Thanks everyone who help with this.
Online now: No Back to the top
1 guest and 0 members have just viewed this.