DrawString through columns Listbox

  1. last week

    Hello, I need to use the Listbox's CellTextPaint event, in order to Draw a String, though the 5 columns of the table in a row.

    I'm Using g.DrawString(String,0,g.textAscent, g.Width, False)

    But only write the text on each cell

    Any clues?

  2. Emile S

    Jul 10 Europe (France, Strasbourg)

    0 in your parameter is the Row nbr,

    you forget to add the Cell number...

  3. Kevin G

    Jul 10 Pre-Release Testers, Xojo Pro Gatesheed, England

    Are you wanting one long string to span the 5 columns?

    If so then you will have to draw the same string in each column with the x position offset.
    so... if your column widths were 50,100,75,25 your x offset for each column would be:
    0,-50,-150,-225,-250

  4. Emile S

    Jul 11 Europe (France, Strasbourg)

    The LR says:
    ListBox.CellTextPaint(g as Graphics, Row as Integer, Column as Integer, x as Integer, y as Integer) As Boolean

    As I wrote earlier (I was in a hurry), you passed the Row #, but not the Column #.

  5. Wayne G

    Jul 11 Pre-Release Testers, Xojo Pro New Zealand axisdirect.nz

    @Karen A has a product for this have a look at http://www.katkosoft.com/Mergeable%20Listbox%20Page/MergeableCellListbox.html

  6. Greg O

    Jul 11 Xojo Inc Somewhere near Raleigh, NC

    @Emile S The LR says:
    ListBox.CellTextPaint(g as Graphics, Row as Integer, Column as Integer, x as Integer, y as Integer) As Boolean

    As I wrote earlier (I was in a hurry), you passed the Row #, but not the Column #.

    That’s an event Emile, not a method.

  7. Emile S

    Jul 11 Europe (France, Strasbourg)

    Gerardo wrote:

    @Gerardo Giacute;a I'm Using g.DrawString(String,0,g.textAscent, g.Width, False)

    And I say he forget the Column value.

    Now I do not understand.

  8. Yes, that I want to do is write a Text that cross all the columns, simulating Merged cells.

    If I use a select case of a column, the text will be in one column, if not, the text will be written on each cell of the row, and I don't like that

  9. @Kevin G Are you wanting one long string to span the 5 columns?

    If so then you will have to draw the same string in each column with the x position offset.
    so... if your column widths were 50,100,75,25 your x offset for each column would be:
    0,-50,-150,-225,-250

    It sound good, I'll gonna try

  10. Emile S

    Jul 11 Europe (France, Strasbourg)

    So you want to simulate a Cell that span in many columns…

    in html, I coded that <td span=5 …>Text data here</td>.

  11. Dave S

    Jul 11 San Diego, California USA

    @Emile S So you want to simulate a Cell that span in many columns…

    in html, I coded that <td span=5 …>Text data here</td>.

    Emile...... just what does doing in HTML have to do with doing it with a Xojo Listbox?

  12. Emile S

    Jul 11 Europe (France, Strasbourg)

    Nothing. A simple example/question to be sure of what was asked…
    It was not an answer. / It was not clear (to me) what was asked.

  13. Greg O

    Jul 11 Xojo Inc Somewhere near Raleigh, NC

    @Emile S Gerardo wrote:

    @Gerardo Garcia I'm Using g.DrawString(String,0,g.textAscent, g.Width, False)

    And I say he forget the Column value.
    Now I do not understand.

    The DrawString method of the Graphics class doesn't have a "column" parameter. I think you confused Graphics.DrawString and Listbox.CellTextPaint.

  14. Emile S

    Jul 11 Europe (France, Strasbourg)

    Hi Greg,

    I think you are right: I read the Event definition (with Row and Column) and the g.DrawString and do a mix in my brain. If I tested the idea I would realize the error.

    Thanks.

or Sign Up to reply!