xsharp.eu • Alignment issue
Page 1 of 1

Alignment issue

Posted: Sat Nov 02, 2019 7:32 am
by Anonymous
Hi again... I'm having trouble where I have a method filling a Listbox, with the following code:

METHOD SMSList() Class Datawindow
LOCAL i
LOCAL aRay as ARRAY
LOCAL cStr
LOCAL dbClients as DBSERVER
dbClients := Regos{}
dbClients:GoTop()

aRay := {}

FOR i := 1 to dbClients:RECCOUNT
cStr := PadR(AllTrim(dbClients:FIELDGET(#REGNO)),20, CHR(32)) + " " + PadR(AllTrim(dbClients:FIELDGET(#SMS)),10, CHR(32))
AAdd(aRay, cStr)
dbClients:Skip()
next i

return aRay


Problem is, it looks like this:
Capture.JPG
Capture.JPG (36.16 KiB) Viewed 279 times
How can I align it so they are in two straight columns please?

Alignment issue

Posted: Sat Nov 02, 2019 8:04 am
by lumberjack
Set the font to a fixed width type e.g. Courier New

Alignment issue

Posted: Sat Nov 02, 2019 8:28 am
by BiggyRat
Brilliant, thank you Sir. I suspected it would be something simple....

Alignment issue

Posted: Sat Nov 02, 2019 11:10 am
by Karl-Heinz
Hi Jeff,

The listbox class has the method SetTabs(aTabs), so there´s no reason to switch to a fixed-width font. To make SetTabs() work:

- set the Listbox painter property "Use Tab Stops" to true
- insert a tab char in your string
- set the tab position.

cStr := AllTrim(dbClients:FIELDGET(#REGNO)) + chr(9) + AllTrim(dbClients:FIELDGET(#SMS))

<oLB>:SetTabs ( { 90} ) increase/decrease the position until it fits your needs.

regards
Karl-Heinz

Alignment issue

Posted: Sat Nov 02, 2019 5:20 pm
by FFF
Cool!
Unfortunately, Vo-Help does't list this method... X#-Help does ;-)

Alignment issue

Posted: Sat Nov 02, 2019 6:00 pm
by robert
Karl,
The X# help is generated from the assemblies and that means that all methods are included unless we explicitely tell the the doc generator to skip a method.

Robert

Alignment issue

Posted: Sun Nov 03, 2019 12:25 am
by BiggyRat
Thank you very much Karl-Heinz, that worked brilliantly, and looks much nicer.