Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Mar 29, 2017 10:04 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Split One row into 2 lines into listbox
PostPosted: Wed May 29, 2013 11:50 pm 
Offline

Joined: Sat Jun 11, 2011 8:46 pm
Posts: 33
I need split one record into 2 lines of my listbox
My code is:

Listlogros.addrow (rs.Field("CODIGO1").StringValue, rs.Field("EQUIPO1").StringValue, rs.Field("MLA").StringValue, rs.Field("CODIGO2").StringValue, rs.Field("EQUIPO2").StringValue, rs.Field("MLB").StringValue)

I need display one row in two lines display

CODIGO1 EQUIPO1
CODIGO2 EQUIPO2

.........
.........

.
Next Record


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 12:28 am 
Offline

Joined: Tue Jul 27, 2010 7:41 am
Posts: 54
Hi FernandoPM

Not sure whether this will help, but is this what you mean?

while not rs.eof
listlogros.addrow rs.field("CODIGO1").Stringvalue,rs.Field("EQUIPO1").StringValue, rs.Field("MLA").StringValue
listlogros.addrow rs.Field("CODIGO2").StringValue, rs.Field("EQUIPO2").StringValue, rs.Field("MLB").StringValue

rs.movenext
wend


Regards,
Josh


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 12:31 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
If you need two lines in one row you can put an EndOfLine in there.
ListBox1.AddRow "Hello" + EndOfLine + "World"

So in your case it would be something like:
Listlogros.addrow (rs.Field("CODIGO1").StringValue, rs.Field("EQUIPO1").StringValue, rs.Field("MLA").StringValue + EndOfLine, rs.Field("CODIGO2").StringValue, rs.Field("EQUIPO2").StringValue, rs.Field("MLB").StringValue)

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 1:45 am 
Offline

Joined: Sat Jun 11, 2011 8:46 pm
Posts: 33
Akiland wrote:
If you need two lines in one row you can put an EndOfLine in there.
ListBox1.AddRow "Hello" + EndOfLine + "World"

So in your case it would be something like:
Listlogros.addrow (rs.Field("CODIGO1").StringValue, rs.Field("EQUIPO1").StringValue, rs.Field("MLA").StringValue + EndOfLine, rs.Field("CODIGO2").StringValue, rs.Field("EQUIPO2").StringValue, rs.Field("MLB").StringValue)


EndOfLine is Operator Incompatible


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 3:02 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
Works for me :)
Image
ListBox1.AddRow "Hello" + EndOfLine + "World"

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 3:12 am 
Offline

Joined: Sat Jun 11, 2011 8:46 pm
Posts: 33
Akiland wrote:
Works for me :)
Image
ListBox1.AddRow "Hello" + EndOfLine + "World"

Yes, is work with string,but fields not

In it case:
Listlogros.addrow (rs.Field("CODIGO1").StringValue, rs.Field("EQUIPO1").StringValue, rs.Field("MLA").StringValue + EndOfLine, rs.Field("CODIGO2").StringValue, rs.Field("EQUIPO2").StringValue, rs.Field("MLB").StringValue)


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 3:20 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
aah, sorry it don't seem to work when you're populating multiple columns.
hmm..tricky

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 9:12 am 
Offline
User avatar

Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1855
Location: Michigan, USA
Just in case you really need this to work and you can't discern a way to do it with the WebListBox, you could try the WebListBoxTD from Web Custom Controls.

_________________
Windows 8 x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 11:21 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
fernandopm wrote:
Yes, is work with string,but fields not

In it case:
Listlogros.addrow (rs.Field("CODIGO1").StringValue, rs.Field("EQUIPO1").StringValue, rs.Field("MLA").StringValue + EndOfLine, rs.Field("CODIGO2").StringValue, rs.Field("EQUIPO2").StringValue, rs.Field("MLB").StringValue)

You're adding an endofline, but not using it. I recommend you simplify your addrow code, get it working, then build it back up. Also, it helps to use local variables, so you can see what is happening.

Oh wait, I think I see what you're trying to do now. You need to address each column separately. Try this:

dim column1, column2, column3 as string
column1 = rs.Field("CODIGO1").StringValue + EndOfLine + rs.Field("CODIGO2").StringValue
column2 = rs.Field("EQUIPO1").StringValue + EndOfLine + rs.Field("EQUIPO2").StringValue
column3 = rs.Field("MLA").StringValue + EndOfLine + rs.Field("MLB").StringValue
Listlogros.addrow(column1, column2, column3)


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 11:58 am 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
While I would love for you to check out Web Custom Controls (thanks Jason!), I am able to use EndOfLine with a multi-column WebListBox and RecordSet fields in 2012r2.1. Here's the code from a test project (WebListBox, WebButton, code is in the button)

Dim rs As RecordSet = ef.SQLSelect("select * from test")

While rs.EOF = False
cnList.AddRow(rs.Field("test1").StringValue + EndOfLine + rs.Field("test2").StringValue, _
rs.Field("test1").StringValue + EndOfLine)
rs.MoveNext
Wend


Image

Note that the second column text appears centered vertically because there is no text after EndOfLine. Even adding a space doesn't force it to align with the first column. There might be some other blank character you can use.

Also: I would test the display on each browser to make sure that the EndOfLine character(s) are interpreted correctly.

If you need more complex formatting, Web Custom Controls lets you put whatever HTML you like into a cell.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 12:04 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
timhare wrote:
Also, it helps to use local variables, so you can see what is happening.


One of the best pieces of advice you can give. Though I didn't do it in the example above, in my working code I error on the side of over using local variables. I prefer each line to do one clearly visible thing.

I find it helps with debugging and with re-engineering code later on.

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
 
 Post subject: Re: Split One row into 2 lines into listbox
PostPosted: Thu May 30, 2013 3:25 pm 
Offline

Joined: Sat Oct 01, 2005 9:55 am
Posts: 527
taylor-design wrote:
Note that the second column text appears centered vertically because there is no text after EndOfLine. Even adding a space doesn't force it to align with the first column. There might be some other blank character you can use.


Try &uA0, the non-breaking space (equivalent of the   entity in HTML).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group