Adding barframe color to listbox affects selected background color of a list box when focus is loss

I am trying out a list box that acts as a sidebar menu. I want to remove dotted lines when a record is selected
image
the solution I used is to add barframe color that is exactly the same with selbackground color. Now when the window loses focus it also affects the selbackground color. Is there a way that it will not affect the selbackground color when the window loses focus?
Image below are the behavior comparison of a listbox with and without barframe color:

I haven’t tried this, but you might want to play with using NOBAR and then dynamically controlling the background colors based on the selected row.

The help for proplist:barframe describes the behavior you are describing as the expected look.

1 Like

Kinda Mickey Mouse, but you can make it work like this:

 PROGRAM

Window WINDOW('Caption'),AT(,,395,224),GRAY,FONT('Microsoft Sans Serif',8)
    BUTTON('&OK'),AT(291,201,41,14),USE(?OkButton),DEFAULT
    BUTTON('&Cancel'),AT(333,201,42,14),USE(?CancelButton)
    LIST,AT(16,12,149,187),USE(?LIST1),COLOR(,COLOR:Black,0FAC6AFH),FROM('YADA|YADA|YADA|'),GRID(COLOR:Black)
  END
  MAP
  END

  CODE

  OPEN(Window)
  
  ACCEPT
    CASE EVENT()
    OF EVENT:LoseFocus
      DO SetLostFocus
    OF EVENT:GainFocus
      DO SetGainFocus
    OF EVENT:Selected
      DO SetGainFocus
    END
    
  
  END
  
  
SetLostFocus ROUTINE

  ?LIST1{PROPLIST:BarFrame} = COLOR:None
  
SetGainFocus ROUTINE

  IF SELECTED() = ?LIST1 AND 0{PROP:ACTIVE}
    ?LIST1{PROPList:BarFrame} = 0FAC6AFH
  ELSE
    DO SetLostFocus
  END  
1 Like

btw, if you have a lot of items in your listbox, then setting BarFrame is not so fast. For this purpose, I’m sure it’s fine.

Works Flawlessly, Thanks a lot :star_struck:

Thanks, I have tried this and give an idea on how it works.