changing row color

Hi All.

After going through the documents and what I found on the forum, I still am having an issue with doing the following:

I have a popupmenu to select different categories, and then change the cellbacgroundcolor.

I can do the alternate row no problems, but can’t get my changing the popupmenu to change the color of a row.

I use a select case group to do this.

here is what I have (i’ve deleted extra repetitive stuff for clarity.). On the groupPopupMenu

Select case groupPopupMenu.SelectedRowIndex case 0 'MessageBox "you selected "+groupPopupMenu.getString mainWindow.mainWindowListbox (RowSet) g.forecolor = &cf3f6fA g.FillRectangle (0,0,g.Width,g.height) case 1 'MessageBox "you selected "+groupPopupMenu.getString case 2 'MessageBox "you selected "+groupPopupMenu.getString case 3 'MessageBox "you selected "+groupPopupMenu.getString case 4 'MessageBox "you selected "+groupPopupMenu.getString end Select

Any help is appreciated.

Regards

Try adding something like this to the popup’s Change event:

ListBox1.Invalidate

Hi Kem.

That didn’t work.

Does it have to do with the fact that I am not within the listbox to use the cellbackgroundpaint?
I don’t seem to be able to call that from the groupPopup events.

Regards

[quote=495530:@Michael Cebasek]Hi Kem.

That didn’t work.

Does it have to do with the fact that I am not within the listbox to use the cellbackgroundpaint?
I don’t seem to be able to call that from the groupPopup events.

Regards
[/quote]

Yes
G in whatever code you have now is likely NOT the listbox graphics context

Not knowing a bunch about your code and what control is what the best I can suggest is that you popup set the rowtag fo htse selectd row and then in the listbox cellbackground paint event you use that rowtag as the color

Select case groupPopupMenu.SelectedRowIndex
case 0
  mainWindow.mainWindowListbox.Rowtag( mainWindow.mainWindowListbox.listindex) = &cf3f6fA
case 1
  'MessageBox "you selected "+groupPopupMenu.getString
case 2
  'MessageBox "you selected "+groupPopupMenu.getString
case 3
  'MessageBox "you selected "+groupPopupMenu.getString
case 4
  'MessageBox "you selected "+groupPopupMenu.getString
end Select

then the cellbackgroundpaint event might look like

    g.forecolor = me.rowtag(row)
    g.fillrect 0,0,g.widh,g.height