Custom Listbox - gridlines problem

I could use a little advice from anyone that has worked with making a custom listbox. I’m needing variable row heights, so I’m trying to role out my own. Everything is working very well so far, with the exception of the grid lines and column headers don’t line up correctly. I’m not sure if there is something else I need to handle in my drawing code or what’s up.

You can see in the picture, the grid lines are shifted to the right of the header divider. My drawing starts at 0, 0 in most cases. Does anyone have any ideas that might help me solve this?

Without seeing the code this impossible. Can you post how you calculate the width of the columns?

This is my code in the open event of the listbox:

  me.InitListbox( 14, "Verdana", 0 , hdListBox.GridModes.Virtual )
  me.ColumnCount = 5
  me.HasHeading = True
  me.Heading( 0 ) = "First Name"
  me.Heading( 1 ) = "Last Name"
  me.Heading( 2 ) = "Pay Rate"
  me.Heading( 3 ) = "Position"
  me.Heading( 4 ) = "Memo"
  me.ColumnWidths = "15%,15%,15%,15%,40%"

I think you are forgetting the width of the scrollbar.

The vertical indent of the first column makes me think you’re drawing those lines in CellTextPaint, because the graphics you get in that event is shifted like that. You’ll need to use CellBackgroundPaint for the whole space. I don’t see what’s misaligned about the headers, looks nice. are you going to share :slight_smile:

The vertical line indent… (post editing only fails me when I make a mistake)

If you are open to a paid solution I have a custom listbox subclass that I think does what you want.

My old website is no more as my ISP no longer provides webspace as of the end of September, but I am in the process of building a new site elsewhere. In the mean time you can download a demo with docs that ONLY runs in the IDE here:

Mergable Cell Listbox

You can code with it that way but for it to run you need to buy a license which gets you teh unencrypted source code.

It lets you merge cell across rows or columns as well as has a lot of other nice features.

For to run the demo in the IDE do not remove teh project from teh folder it comes in… The Demo needs pictures that are there and it needs to know where to find them

Let me know if you are interested

  • Karen

I Just put up the new website… It still needs some work, but the new URL to the page for the mergeable cell listbox is:

Mergable Cell Listbox

Also to clarify you can code and run with the demo classes in IDE for free, however you need a license to use them in built apps.

  • Karen

Didn’t realize you could do all that with the Listbox…Nice Work Karen!!

Thanks… I’ve had that available for over 4 years.

You can do a lot with the Xojo listbox… which is why I am always amazed when people say it is very limited. It’s API is worth learning!

You nailed it Will… that makes sense. I guess sitting up all night working left me a little fuzzy headed. I could not figure out what was going on, but it was so simple.

Thank you very much.

I might once I get it finished.

[quote=133629:@Karen Atkocius]If you are open to a paid solution I have a custom listbox subclass that I think does what you want.

  • Karen[/quote]

Karen, your listbox is my backup plan if mine doesn’t work out. I downloaded yours a while back and it’s awesome.